Merge branch 'm24_MDL-36364_Improve_the_deletion_logic' of https://github.com/scara...
authorDan Poltawski <dan@moodle.com>
Fri, 16 Nov 2012 07:24:24 +0000 (15:24 +0800)
committerDan Poltawski <dan@moodle.com>
Fri, 16 Nov 2012 07:24:24 +0000 (15:24 +0800)
Conflicts:
cache/stores/file/lib.php

cache/stores/file/lib.php

index 0a18b3a..19fdfb6 100644 (file)
@@ -373,9 +373,13 @@ class cachestore_file implements cache_store, cache_is_key_aware {
     public function delete($key) {
         $filename = $key.'.cache';
         $file = $this->file_path_for_key($key);
-        $result = @unlink($file);
-        unset($this->keys[$filename]);
-        return $result;
+
+        if (@unlink($file)) {
+            unset($this->keys[$filename]);
+            return true;
+        }
+
+        return false;
     }
 
     /**
@@ -682,4 +686,4 @@ class cachestore_file implements cache_store, cache_is_key_aware {
     public function my_name() {
         return $this->name;
     }
-}
\ No newline at end of file
+}