From bd0185707b2ed7e94c5d1c3e5f92747dfe121dfa Mon Sep 17 00:00:00 2001 From: scyrma Date: Thu, 9 Oct 2008 06:20:17 +0000 Subject: [PATCH] Files/MDL-14231: return false on file not found so that the user is warned that the file could not be deleted. --- lib/filelib.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/filelib.php b/lib/filelib.php index f5d10b65cc6..cc4cb813144 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -928,10 +928,11 @@ function put_records_csv($file, $records, $table = NULL) { /** * Recursively delete the file or folder with path $location. That is, * if it is a file delete it. If it is a folder, delete all its content - * then delete it. If $location does not exist to start, that is not - * considered an error. + * then delete it. Does not throw an error if the location does not exists, + * but will return false. * * @param $location the path to remove. + * @return bool true if the call to unlink() was successful, false otherwise; */ function fulldelete($location) { if (is_dir($location)) { @@ -959,6 +960,8 @@ function fulldelete($location) { if (!unlink($location)) { return false; } + } else { + return false; } return true; }