Update UserController.php

This commit is contained in:
Julian Prieber 2024-10-08 16:39:08 +02:00
parent 0d4caa7110
commit 434e6bbd7a
1 changed files with 6 additions and 11 deletions

View File

@ -748,17 +748,12 @@ class UserController extends Controller
$files = scandir($folder); $files = scandir($folder);
foreach ($files as $file) { foreach ($files as $file) {
if ($file !== '.' && $file !== '..') { $basename = basename($file);
if (preg_match($regex, $file)) { if (preg_match($regex, $basename)) {
$new_file = preg_replace($regex, '', $file); $newBasename = preg_replace($regex, '', $basename);
File::copyDirectory($folder . '/' . $file, $folder . '/' . $new_file); $newPath = $folder . '/' . $newBasename;
$dirname = $folder . '/' . $file; File::copyDirectory($file, $newPath);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { File::deleteDirectory($file);
system('rmdir ' . escapeshellarg($dirname) . ' /s /q');
} else {
system("rm -rf " . escapeshellarg($dirname));
}
}
} }
} }
} }