aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php')
-rw-r--r--phpBB/phpbb/install/helper/iohandler/ajax_iohandler.php41
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