From 6311eb61e4662d9c3bfbf17e0c0f4b75ae6a01d2 Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 27 Aug 2008 08:23:07 +0000 Subject: [PATCH] MDL-16220 allow deleting of all files attached to context --- lib/file/file_storage.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/file/file_storage.php b/lib/file/file_storage.php index 5bb9e9f73f..ab2ef6dd00 100644 --- a/lib/file/file_storage.php +++ b/lib/file/file_storage.php @@ -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; } -- 2.39.5