Skip to content

Commit

Permalink
Update UserController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianPrieber committed Oct 8, 2024
1 parent 0d4caa7 commit 434e6bb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,17 +748,12 @@ public function editTheme(request $request)
$files = scandir($folder);

foreach ($files as $file) {
if ($file !== '.' && $file !== '..') {
if (preg_match($regex, $file)) {
$new_file = preg_replace($regex, '', $file);
File::copyDirectory($folder . '/' . $file, $folder . '/' . $new_file);
$dirname = $folder . '/' . $file;
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
system('rmdir ' . escapeshellarg($dirname) . ' /s /q');
} else {
system("rm -rf " . escapeshellarg($dirname));
}
}
$basename = basename($file);
if (preg_match($regex, $basename)) {
$newBasename = preg_replace($regex, '', $basename);
$newPath = $folder . '/' . $newBasename;
File::copyDirectory($file, $newPath);
File::deleteDirectory($file);
}
}
}
Expand Down

0 comments on commit 434e6bb

Please sign in to comment.