diff --git a/web/includes/functions.php b/web/includes/functions.php index cdfa2d4a1..2f2a0f257 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -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()"); } }