Fixup deletePath. Handle links, and report failures. Fix escaping the filename and put it in quotes in case it has spaces. Fixes #4446
parent
8f475faf12
commit
fdfe87be38
|
@ -362,10 +362,16 @@ function getEventDefaultVideoPath($event) {
|
|||
|
||||
function deletePath( $path ) {
|
||||
ZM\Debug('Deleting '.$path);
|
||||
if (is_dir($path)) {
|
||||
system(escapeshellcmd('rm -rf '.$path));
|
||||
if (is_link($path)) {
|
||||
if (!unlink($path)) ZM\Debug("Failed to unlink $path");
|
||||
} else if (is_dir($path)) {
|
||||
if (false === ($output = system('rm -rf "'.escapeshellcmd($path).'"'))) {
|
||||
ZM\Warning('Failed doing rm -rf "'.escapeshellcmd($path).'"');
|
||||
}
|
||||
} else if (file_exists($path)) {
|
||||
unlink($path);
|
||||
if (!unlink($path)) ZM\Debug("Failed to delete $path");
|
||||
} else {
|
||||
ZM\Warning("Path $path does not exist in deletePath()");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue