Moved a generic function over
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user