Fix upgrade command when it has to clear the compiled cache.

This commit is contained in:
Alexandre Rosenfeld
2011-02-21 15:35:50 +00:00
parent 3f4eb7b6d2
commit 142df3616f

View File

@@ -40,20 +40,20 @@ CLI::taskRun(run_upgrade);
/**
* A versoni of rm_dir which does not exits on error.
* A version of rm_dir which does not exits on error.
*
* @param string $filename directory or file to remove
* @param bool $filesOnly either to remove the containing directory as well or not
*/
function rm_dir($filename, $filesOnly = false) {
if (is_file($filename)) {
@unlink($filename) or CLI::message(CLI::error("Could not remove file $filename")."\n");;
@unlink($filename) or CLI::logging(CLI::error("Could not remove file $filename")."\n");
} else {
foreach(glob("$filename/*") as $f) {
rm_dir($f);
}
if (!$filesOnly)
@rmdir($filename) or CLI::message(CLI::error("Could not remove directory $filename")."\n");
@rmdir($filename) or CLI::logging(CLI::error("Could not remove directory $filename")."\n");
}
}