improve fault tolerance of missing directories
This commit is contained in:
parent
994b827643
commit
f00033ab1b
@ -178,20 +178,28 @@ class SetupController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public static function checkTextureDirectory()
|
||||
public static function checkDirectories()
|
||||
{
|
||||
if (!Storage::disk('storage')->has('textures')) {
|
||||
// mkdir
|
||||
if (!Storage::disk('storage')->makeDirectory('textures'))
|
||||
return false;
|
||||
}
|
||||
$directories = ['storage/textures', 'plugins'];
|
||||
|
||||
return true;
|
||||
try {
|
||||
foreach ($directories as $dir) {
|
||||
if (!Storage::disk('root')->has($dir)) {
|
||||
// mkdir
|
||||
if (!Storage::disk('root')->makeDirectory($dir))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected function createDirectories()
|
||||
{
|
||||
return self::checkTextureDirectory();
|
||||
return self::checkDirectories();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ class BootServiceProvider extends ServiceProvider
|
||||
return redirect('/setup')->send();
|
||||
}
|
||||
|
||||
if (!SetupController::checkTextureDirectory()) {
|
||||
if (!SetupController::checkDirectories()) {
|
||||
throw new PrettyPageException(trans('setup.file.permission-error'), -1);
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,11 @@ return [
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
'root' => [
|
||||
'driver' => 'local',
|
||||
'root' => base_path(),
|
||||
],
|
||||
|
||||
'storage' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path(),
|
||||
|
Loading…
Reference in New Issue
Block a user