[ Index ]

PHP Cross Reference of phpBB-3.2.8-deutsch

title

Body

[close]

/phpbb/install/controller/ -> timeout_check.php (source)

   1  <?php
   2  /**
   3   *
   4   * This file is part of the phpBB Forum Software package.
   5   *
   6   * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7   * @license GNU General Public License, version 2 (GPL-2.0)
   8   *
   9   * For full copyright and license information, please see
  10   * the docs/CREDITS.txt file.
  11   *
  12   */
  13  
  14  namespace phpbb\install\controller;
  15  
  16  use Symfony\Component\HttpFoundation\JsonResponse;
  17  
  18  class timeout_check
  19  {
  20      /**
  21       * @var helper
  22       */
  23      protected $helper;
  24  
  25      /**
  26       * @var string
  27       */
  28      protected $phpbb_root_path;
  29  
  30      /**
  31       * Constructor
  32       *
  33       * @param helper    $helper
  34       * @param string    $phpbb_root_path
  35       */
  36  	public function __construct(helper $helper, $phpbb_root_path)
  37      {
  38          $this->helper = $helper;
  39          $this->phpbb_root_path = $phpbb_root_path;
  40      }
  41  
  42      /**
  43       * Controller for querying installer status
  44       */
  45  	public function status()
  46      {
  47          $lock_file = $this->phpbb_root_path . 'store/io_lock.lock';
  48          $response = new JsonResponse();
  49  
  50          if (!file_exists($lock_file))
  51          {
  52              $response->setData(array(
  53                  'status' => 'fail',
  54              ));
  55          }
  56          else
  57          {
  58              $fp = @fopen($lock_file, 'r');
  59  
  60              if ($fp && flock($fp, LOCK_EX | LOCK_NB))
  61              {
  62                  $status = (filesize($lock_file) >= 2 && fread($fp, 2) === 'ok') ? 'continue' : 'fail';
  63  
  64                  $response->setData(array(
  65                      'status' => $status,
  66                  ));
  67                  flock($fp, LOCK_UN);
  68                  fclose($fp);
  69              }
  70              else
  71              {
  72                  $response->setData(array(
  73                      'status' => 'running',
  74                  ));
  75              }
  76          }
  77  
  78          return $response;
  79      }
  80  }


Generated: Tue Apr 7 19:42:26 2020 Cross-referenced by PHPXref 0.7.1