fix upload delete

Dieser Commit ist enthalten in:
o.pinke 2024-04-12 20:35:30 +02:00
Ursprung 4d65fba9dc
Commit 92181aba97
1 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -116,10 +116,10 @@ if ($action == "upl_delete") {
if (is_dbfs($path)) { if (is_dbfs($path)) {
$dbfs->remove($path . "/."); $dbfs->remove($path . "/.");
} else { } else {
$failedFiles = [];
/* Check for files */ /* Check for files */
if (uplHasFiles($path)) { if (uplHasFiles($path)) {
$failedFiles = array();
$directory = opendir($cfgClient[$client]["upl"]["path"] . $path); $directory = opendir($cfgClient[$client]["upl"]["path"] . $path);
while (false !== ($dir_entry = readdir($directory))) { while (false !== ($dir_entry = readdir($directory))) {
if ($dir_entry != "." && $dir_entry != "..") { if ($dir_entry != "." && $dir_entry != "..") {
@ -132,11 +132,11 @@ if ($action == "upl_delete") {
} }
} }
if (count($failedFiles) > 0) { if ($failedFiles !== []) {
$notification->displayNotification("warning", i18n("Failed to delete the following files:") . "<br><br>" . implode("<br>", $failedFiles)); $notification->displayNotification("warning", i18n("Failed to delete the following files:") . "<br><br>" . implode("<br>", $failedFiles));
} else { } else {
$res = @ rmdir($cfgClient[$client]['upl']['path'] . $path); $res = @rmdir($cfgClient[$client]['upl']['path'] . $path);
if ($res == false) { if (!$res) {
$notification->displayNotification("warning", sprintf(i18n("Failed to remove directory %s"), $path)); $notification->displayNotification("warning", sprintf(i18n("Failed to remove directory %s"), $path));
} }
} }