Merge branch 'MDL-45654-27' of https://github.com/rtcn2/moodle into MOODLE_27_STABLE

This commit is contained in:
Sam Hemelryk
2014-05-26 08:58:13 +12:00
2 changed files with 83 additions and 56 deletions
+5 -2
View File
@@ -60,8 +60,11 @@ class file_temp_cleanup_task extends scheduled_task {
// Check if file or directory is older than the given time.
if ($iter->getMTime() < $time) {
if ($iter->isDir() && !$iter->isDot()) {
if (@rmdir($node) === false) {
mtrace("Failed removing directory '$node'.");
// Don't attempt to delete the directory if it isn't empty.
if (!glob($node. DIRECTORY_SEPARATOR . '*')) {
if (@rmdir($node) === false) {
mtrace("Failed removing directory '$node'.");
}
}
}
if ($iter->isFile()) {