diff options
author | Máté Bartus <mate.bartus@gmail.com> | 2016-02-28 00:19:24 +0100 |
---|---|---|
committer | Máté Bartus <mate.bartus@gmail.com> | 2016-02-28 14:05:07 +0100 |
commit | 062358f8b1d9a7fa3d9be97f6b58e06fea7ca844 (patch) | |
tree | 88c0da83c6a25eda15c9fd70af5dc23ae3ddb77a /phpBB/phpbb/install/helper/iohandler | |
parent | 30db51a86e009f50920f8c0c6c05da26e2b10a56 (diff) | |
download | forums-062358f8b1d9a7fa3d9be97f6b58e06fea7ca844.tar forums-062358f8b1d9a7fa3d9be97f6b58e06fea7ca844.tar.gz forums-062358f8b1d9a7fa3d9be97f6b58e06fea7ca844.tar.bz2 forums-062358f8b1d9a7fa3d9be97f6b58e06fea7ca844.tar.xz forums-062358f8b1d9a7fa3d9be97f6b58e06fea7ca844.zip |
[ticket/14487] Try to handle connection timeouts
PHPBB3-14487
Diffstat (limited to 'phpBB/phpbb/install/helper/iohandler')
-rw-r--r-- | phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php index 8c62ec7bd0..c168d26425 100644 --- a/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php +++ b/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php @@ -44,6 +44,11 @@ class ajax_iohandler extends iohandler_base /** * @var string */ + protected $phpbb_root_path; + + /** + * @var string + */ protected $file_status; /** @@ -77,14 +82,20 @@ class ajax_iohandler extends iohandler_base protected $redirect_url; /** + * @var resource + */ + protected $file_lock_pointer; + + /** * Constructor * * @param path_helper $path_helper * @param \phpbb\request\request_interface $request HTTP request interface * @param \phpbb\template\template $template Template engine * @param router $router Router + * @param string $root_path Path to phpBB's root */ - public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router) + public function __construct(path_helper $path_helper, \phpbb\request\request_interface $request, \phpbb\template\template $template, router $router, $root_path) { $this->path_helper = $path_helper; $this->request = $request; @@ -96,6 +107,7 @@ class ajax_iohandler extends iohandler_base $this->download = array(); $this->redirect_url = array(); $this->file_status = ''; + $this->phpbb_root_path = $root_path; parent::__construct(); } @@ -433,6 +445,33 @@ class ajax_iohandler extends iohandler_base } /** + * Acquires a file lock + */ + public function acquire_lock() + { + $lock_file = $this->phpbb_root_path . 'store/io_lock.lock'; + $this->file_lock_pointer = @fopen($lock_file, 'w+'); + + if ($this->file_lock_pointer) + { + flock($this->file_lock_pointer, LOCK_EX); + } + } + + /** + * Release file lock + */ + public function release_lock() + { + if ($this->file_lock_pointer) + { + fwrite($this->file_lock_pointer, 'ok'); + flock($this->file_lock_pointer, LOCK_UN); + fclose($this->file_lock_pointer); + } + } + + /** * Callback function for language replacing * * @param array $matches |