mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-05-02 19:08:42 +02:00
Check themes folder when updating
This commit is contained in:
parent
d69558aefd
commit
d5721ae31e
@ -429,4 +429,42 @@ try {
|
|||||||
session(['update_error' => $e->getMessage()]);
|
session(['update_error' => $e->getMessage()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$themesPath = base_path('themes');
|
||||||
|
$regex = '/[0-9.-]/';
|
||||||
|
$files = scandir($themesPath);
|
||||||
|
$files = array_diff($files, array('.', '..'));
|
||||||
|
|
||||||
|
$themeError = 'The update was successful. Your theme-filesystem was detected as corrupted and has been reset.';
|
||||||
|
|
||||||
|
foreach ($files as $file) {
|
||||||
|
|
||||||
|
$basename = basename($file);
|
||||||
|
$filePath = $themesPath . '/' . $basename;
|
||||||
|
|
||||||
|
if (!is_dir($filePath)) {
|
||||||
|
|
||||||
|
File::deleteDirectory($themesPath);
|
||||||
|
mkdir($themesPath);
|
||||||
|
session(['update_error' => $themeError]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match($regex, $basename)) {
|
||||||
|
|
||||||
|
$newBasename = preg_replace($regex, '', $basename);
|
||||||
|
$newPath = $themesPath . '/' . $newBasename;
|
||||||
|
File::copyDirectory($filePath, $newPath);
|
||||||
|
File::deleteDirectory($filePath);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (exception $e) {
|
||||||
|
session(['update_error' => $e->getMessage()]);
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user