mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[ticket/10103] Convert the rest of the tree to flock class.
PHPBB3-10103
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user