mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Merge pull request #1617 from davidsteinsland/master
Fixed race conditions for FileEngine. Using file_exists() and unlink() together does not ensure atomic results.
This commit is contained in:
commit
af3065d377
1 changed files with 3 additions and 3 deletions
|
@ -210,7 +210,7 @@ class FileEngine extends CacheEngine {
|
|||
}
|
||||
$path = $this->_File->getRealPath();
|
||||
$this->_File = null;
|
||||
return unlink($path);
|
||||
return @unlink($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -291,7 +291,7 @@ class FileEngine extends CacheEngine {
|
|||
if ($file->isFile()) {
|
||||
$_path = $file->getRealPath();
|
||||
$file = null;
|
||||
unlink($_path);
|
||||
@unlink($_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ class FileEngine extends CacheEngine {
|
|||
$containsGroup = strpos($object->getPathName(), DS . $group . DS) !== false;
|
||||
$hasPrefix = strpos($object->getBaseName(), $this->settings['prefix']) === 0;
|
||||
if ($object->isFile() && $containsGroup && $hasPrefix) {
|
||||
unlink($object->getPathName());
|
||||
@unlink($object->getPathName());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue