]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16220 allow deleting of all files attached to context
authorskodak <skodak>
Wed, 27 Aug 2008 08:23:07 +0000 (08:23 +0000)
committerskodak <skodak>
Wed, 27 Aug 2008 08:23:07 +0000 (08:23 +0000)
lib/file/file_storage.php

index 5bb9e9f73fd3ed5267fe20a80d544da573daf6cf..ab2ef6dd007237eee19699a8f6b00c0c631ebbe0 100644 (file)
@@ -243,14 +243,17 @@ class file_storage {
     /**
      * Delete all area files (optionally limited by itemid)
      * @param int $contextid
-     * @param string $filearea
+     * @param string $filearea (all areas in context if not specified)
      * @param int $itemid (all files if not specified)
      * @return success
      */
-    public function delete_area_files($contextid, $filearea, $itemid=false) {
+    public function delete_area_files($contextid, $filearea=false, $itemid=false) {
         global $DB;
 
-        $conditions = array('contextid'=>$contextid, 'filearea'=>$filearea);
+        $conditions = array('contextid'=>$contextid);
+        if ($filearea !== false) {
+            $conditions['filearea'] = $filearea;
+        }
         if ($itemid !== false) {
             $conditions['itemid'] = $itemid;
         }