mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
"Fixes #3717, Temp files read/write errors under load"
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6205 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
b99ac8de46
commit
63a4e2e899
1 changed files with 4 additions and 5 deletions
|
@ -522,6 +522,7 @@ if (!function_exists('clone')) {
|
|||
if ($write === false) {
|
||||
return false;
|
||||
} else {
|
||||
@fclose($res);
|
||||
return $write;
|
||||
}
|
||||
}
|
||||
|
@ -558,25 +559,23 @@ if (!function_exists('clone')) {
|
|||
$filename = TMP . $path;
|
||||
break;
|
||||
}
|
||||
|
||||
$timediff = $expires - $now;
|
||||
$filetime = false;
|
||||
|
||||
if (file_exists($filename)) {
|
||||
$filetime = @filemtime($filename);
|
||||
}
|
||||
|
||||
if ($data === null) {
|
||||
// Read data from file
|
||||
if (file_exists($filename) && $filetime !== false) {
|
||||
if ($filetime + $timediff < $now) {
|
||||
// File has expired
|
||||
@unlink($filename);
|
||||
} else {
|
||||
$data = file_get_contents($filename);
|
||||
$data = @file_get_contents($filename);
|
||||
}
|
||||
}
|
||||
} elseif (is_writable(dirname($filename))) {
|
||||
file_put_contents($filename, $data);
|
||||
@file_put_contents($filename, $data);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue