diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2012-12-04 02:26:55 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2012-12-04 02:26:55 -0500 |
commit | 318140b4d6257dd49ae86ed1185568f4d523e53e (patch) | |
tree | 36bffaab6354683dd981d92d1794e51ff44316d2 /phpBB/includes/cache | |
parent | f72e435759e8fafe3b06af35072c1907ba016546 (diff) | |
download | forums-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/cache')
-rw-r--r-- | phpBB/includes/cache/driver/file.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/phpBB/includes/cache/driver/file.php b/phpBB/includes/cache/driver/file.php index a0f06dde4b..ee1b430451 100644 --- a/phpBB/includes/cache/driver/file.php +++ b/phpBB/includes/cache/driver/file.php @@ -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; } /** |