aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template/compile.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2012-12-04 02:26:55 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-04 02:26:55 -0500
commit318140b4d6257dd49ae86ed1185568f4d523e53e (patch)
tree36bffaab6354683dd981d92d1794e51ff44316d2 /phpBB/includes/template/compile.php
parentf72e435759e8fafe3b06af35072c1907ba016546 (diff)
downloadforums-318140b4d6257dd49ae86ed1185568f4d523e53e.tar
forums-318140b4d6257dd49ae86ed1185568f4d523e53e.tar.gz
forums-318140b4d6257dd49ae86ed1185568f4d523e53e.tar.bz2
forums-318140b4d6257dd49ae86ed1185568f4d523e53e.tar.xz
forums-318140b4d6257dd49ae86ed1185568f4d523e53e.zip
[ticket/10103] Convert the rest of the tree to flock class.
PHPBB3-10103
Diffstat (limited to 'phpBB/includes/template/compile.php')
-rw-r--r--phpBB/includes/template/compile.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/phpBB/includes/template/compile.php b/phpBB/includes/template/compile.php
index d0b3d0f115..22da21820e 100644
--- a/phpBB/includes/template/compile.php
+++ b/phpBB/includes/template/compile.php
@@ -58,6 +58,9 @@ class phpbb_template_compile
*/
public function compile_file_to_file($source_file, $compiled_file)
{
+ $lock = new phpbb_lock_flock($compiled_file);
+ $lock->acquire();
+
$source_handle = @fopen($source_file, 'rb');
$destination_handle = @fopen($compiled_file, 'wb');
@@ -66,16 +69,15 @@ class phpbb_template_compile
return false;
}
- @flock($destination_handle, LOCK_EX);
-
$this->compile_stream_to_stream($source_handle, $destination_handle);
@fclose($source_handle);
- @flock($destination_handle, LOCK_UN);
@fclose($destination_handle);
phpbb_chmod($compiled_file, CHMOD_READ | CHMOD_WRITE);
+ $lock->release();
+
clearstatcache();
return true;