File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -748,17 +748,12 @@ public function editTheme(request $request)
748
748
$ files = scandir ($ folder );
749
749
750
750
foreach ($ files as $ file ) {
751
- if ($ file !== '. ' && $ file !== '.. ' ) {
752
- if (preg_match ($ regex , $ file )) {
753
- $ new_file = preg_replace ($ regex , '' , $ file );
754
- File::copyDirectory ($ folder . '/ ' . $ file , $ folder . '/ ' . $ new_file );
755
- $ dirname = $ folder . '/ ' . $ file ;
756
- if (strtoupper (substr (PHP_OS , 0 , 3 )) === 'WIN ' ) {
757
- system ('rmdir ' . escapeshellarg ($ dirname ) . ' /s /q ' );
758
- } else {
759
- system ("rm -rf " . escapeshellarg ($ dirname ));
760
- }
761
- }
751
+ $ basename = basename ($ file );
752
+ if (preg_match ($ regex , $ basename )) {
753
+ $ newBasename = preg_replace ($ regex , '' , $ basename );
754
+ $ newPath = $ folder . '/ ' . $ newBasename ;
755
+ File::copyDirectory ($ file , $ newPath );
756
+ File::deleteDirectory ($ file );
762
757
}
763
758
}
764
759
}
You can’t perform that action at this time.
0 commit comments