Moved a generic function over

This commit is contained in:
moodler
2005-04-26 15:51:31 +00:00
parent a2d71d8edd
commit f401cc9719
2 changed files with 33 additions and 31 deletions
+33
View File
@@ -278,6 +278,7 @@ function put_records_csv($file, $records, $table = NULL) {
return true;
}
if (!function_exists('file_get_contents')) {
function file_get_contents($file) {
$file = file($file);
@@ -285,4 +286,36 @@ if (!function_exists('file_get_contents')) {
}
}
function fulldelete($location) {
if (is_dir($location)) {
$currdir = opendir($location);
while (false !== ($file = readdir($currdir))) {
if ($file <> ".." && $file <> ".") {
$fullfile = $location."/".$file;
if (is_dir($fullfile)) {
if (!fulldelete($fullfile)) {
return false;
}
} else {
if (!unlink($fullfile)) {
return false;
}
}
}
}
closedir($currdir);
if (! rmdir($location)) {
return false;
}
} else {
if (!unlink($location)) {
return false;
}
}
return true;
}
?>