Merge pull request #22209 from nextcloud/backport/21677/stable19

[stable19] Do clearstatcache() on rmdir
This commit is contained in:
Roeland Jago Douma 2020-08-13 05:07:36 +02:00 committed by GitHub
commit baa64827d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -108,6 +108,7 @@ class Local extends \OC\Files\Storage\Common {
* @var \SplFileInfo $file * @var \SplFileInfo $file
*/ */
$file = $it->current(); $file = $it->current();
clearstatcache(true, $this->getSourcePath($file));
if (in_array($file->getBasename(), ['.', '..'])) { if (in_array($file->getBasename(), ['.', '..'])) {
$it->next(); $it->next();
continue; continue;
@ -118,6 +119,7 @@ class Local extends \OC\Files\Storage\Common {
} }
$it->next(); $it->next();
} }
clearstatcache(true, $this->getSourcePath($path));
return rmdir($this->getSourcePath($path)); return rmdir($this->getSourcePath($path));
} catch (\UnexpectedValueException $e) { } catch (\UnexpectedValueException $e) {
return false; return false;
@ -140,8 +142,8 @@ class Local extends \OC\Files\Storage\Common {
} }
public function stat($path) { public function stat($path) {
clearstatcache();
$fullPath = $this->getSourcePath($path); $fullPath = $this->getSourcePath($path);
clearstatcache(true, $fullPath);
$statResult = stat($fullPath); $statResult = stat($fullPath);
if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) { if (PHP_INT_SIZE === 4 && !$this->is_dir($path)) {
$filesize = $this->filesize($path); $filesize = $this->filesize($path);
@ -156,7 +158,7 @@ class Local extends \OC\Files\Storage\Common {
*/ */
public function getMetaData($path) { public function getMetaData($path) {
$fullPath = $this->getSourcePath($path); $fullPath = $this->getSourcePath($path);
clearstatcache(); clearstatcache(true, $fullPath);
$stat = @stat($fullPath); $stat = @stat($fullPath);
if (!$stat) { if (!$stat) {
return null; return null;