diff options
| author | Marc Alexander <admin@m-a-styles.de> | 2016-03-01 21:52:05 +0100 | 
|---|---|---|
| committer | Marc Alexander <admin@m-a-styles.de> | 2016-03-01 21:52:05 +0100 | 
| commit | a38a6ec7f551ca0c5c81969520ad6390e69b0a60 (patch) | |
| tree | 94771f90ca2949327f5a4fab22b57cf17f953069 /phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php | |
| parent | b80cb8e796a107a49b77b0efe9d43ee7ef550655 (diff) | |
| parent | b1a136e7bd8cc06ee320655a4ee7cf72dcd7c611 (diff) | |
| download | forums-a38a6ec7f551ca0c5c81969520ad6390e69b0a60.tar forums-a38a6ec7f551ca0c5c81969520ad6390e69b0a60.tar.gz forums-a38a6ec7f551ca0c5c81969520ad6390e69b0a60.tar.bz2 forums-a38a6ec7f551ca0c5c81969520ad6390e69b0a60.tar.xz forums-a38a6ec7f551ca0c5c81969520ad6390e69b0a60.zip  | |
Merge pull request #4196 from CHItA/ticket/14487
[ticket/14487] Try to handle connection timeouts
Diffstat (limited to 'phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php')
| -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  | 
