1
0
mirror of https://github.com/moodle/moodle.git synced 2025-03-15 05:00:06 +01:00

MDL-30349 make sure file stat cache is reset properly after each remove_dir()

Typo3 does this, maybe it works around some PHP bugs…
This commit is contained in:
Petr Skoda 2011-11-19 10:36:37 +01:00
parent fe41ba7489
commit 0b9f2a02ab
2 changed files with 8 additions and 3 deletions

@ -1437,8 +1437,6 @@ function purge_all_caches() {
// hack: this script may get called after the purifier was initialised,
// but we do not want to verify repeatedly this exists in each call
make_cache_directory('htmlpurifier');
clearstatcache();
}
/**
@ -9867,9 +9865,12 @@ function remove_dir($dir, $content_only=false) {
}
closedir($handle);
if ($content_only) {
clearstatcache(); // make sure file stat cache is properly invalidated
return $result;
}
return rmdir($dir); // if anything left the result will be false, no need for && $result
$result = rmdir($dir); // if anything left the result will be false, no need for && $result
clearstatcache(); // make sure file stat cache is properly invalidated
return $result;
}
/**

@ -1077,6 +1077,10 @@ function redirect_if_major_upgrade_required() {
* files outside of dataroot if you supply custom paths for some settings in config.php.
* This function does not verify that the directory is writable.
*
* NOTE: this function uses current file stat cache,
* please use clearstatcache() before this if you expect that the
* directories may have been removed recently from a different request.
*
* @param string $dir absolute directory path
* @param boolean $create directory if does not exist
* @param boolean $recursive create directory recursively