mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/10103] Convert the rest of the tree to flock class.
PHPBB3-10103
This commit is contained in:
16
phpBB/includes/cache/driver/file.php
vendored
16
phpBB/includes/cache/driver/file.php
vendored
@@ -653,10 +653,11 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
|
||||
$file = "{$this->cache_dir}$filename.$phpEx";
|
||||
|
||||
$lock = new phpbb_lock_flock($file);
|
||||
$lock->acquire();
|
||||
|
||||
if ($handle = @fopen($file, 'wb'))
|
||||
{
|
||||
@flock($handle, LOCK_EX);
|
||||
|
||||
// File header
|
||||
fwrite($handle, '<' . '?php exit; ?' . '>');
|
||||
|
||||
@@ -697,7 +698,6 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
fwrite($handle, $data);
|
||||
}
|
||||
|
||||
@flock($handle, LOCK_UN);
|
||||
fclose($handle);
|
||||
|
||||
if (!function_exists('phpbb_chmod'))
|
||||
@@ -708,10 +708,16 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||
|
||||
phpbb_chmod($file, CHMOD_READ | CHMOD_WRITE);
|
||||
|
||||
return true;
|
||||
$rv = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rv = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
$lock->release();
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user