Skip to content

Commit

Permalink
Change fulldelete(), so it does not give an error if the thing you tr…
Browse files Browse the repository at this point in the history
…y to delete does not exist.
  • Loading branch information
tjhunt committed Mar 1, 2006
1 parent 73bb9da commit 34763a7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/filelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ function file_get_contents($file) {
}


/**
* 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.
*
* @param $location the path to remove.
*/
function fulldelete($location) {
if (is_dir($location)) {
$currdir = opendir($location);
Expand All @@ -426,7 +434,7 @@ function fulldelete($location) {
return false;
}

} else {
} else if (file_exists($location)) {
if (!unlink($location)) {
return false;
}
Expand Down

0 comments on commit 34763a7

Please sign in to comment.