File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
resources/views/components Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 429429 session ([' update_error' => $e -> getMessage ()]);
430430}
431431
432+ try {
433+
434+ $themesPath = base_path (' themes' );
435+ $regex = '/ [0-9.-] /' ;
436+ $files = scandir ($themesPath );
437+ $files = array_diff ($files , array (' .' , ' ..' ));
438+
439+ $themeError = ' The update was successful. Your theme-filesystem was detected as corrupted and has been reset.' ;
440+
441+ foreach ($files as $file ) {
442+
443+ $basename = basename ($file );
444+ $filePath = $themesPath . ' /' . $basename ;
445+
446+ if (! is_dir ($filePath )) {
447+
448+ File:: deleteDirectory ($themesPath );
449+ mkdir ($themesPath );
450+ session ([' update_error' => $themeError ]);
451+ break ;
452+
453+ }
454+
455+ if (preg_match ($regex , $basename )) {
456+
457+ $newBasename = preg_replace ($regex , ' ' , $basename );
458+ $newPath = $themesPath . ' /' . $newBasename ;
459+ File:: copyDirectory ($filePath , $newPath );
460+ File:: deleteDirectory ($filePath );
461+
462+ }
463+
464+ }
465+
466+ } catch (exception $e ) {
467+ session ([' update_error' => $e -> getMessage ()]);
468+ }
469+
432470? >
You can’t perform that action at this time.
0 commit comments