diff --git a/modules/Installer/Config/config.php b/modules/Installer/Config/config.php index 44efaa95..76ea37af 100644 --- a/modules/Installer/Config/config.php +++ b/modules/Installer/Config/config.php @@ -1,14 +1,10 @@ [ 'version' => '7.0.0' ], - # TODO: Remove eventually -// 'env_postfix' => '.generated', 'env_postfix' => '', 'extensions' => [ @@ -20,9 +16,15 @@ return [ 'cURL', ], + # Make sure these are writable 'permissions' => [ - 'storage/framework/' => 'writeable', - 'storage/logs/' => 'writeable', - 'bootstrap/cache/' => 'writable' + 'bootstrap/cache', + 'storage', + 'storage/app/public', + 'storage/framework', + 'storage/framework/cache', + 'storage/framework/sessions', + 'storage/framework/views', + 'storage/logs', ], ]; diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index 9f6c0d47..7fff0358 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -2,6 +2,7 @@ namespace Modules\Installer\Http\Controllers; +use Illuminate\Database\QueryException; use Log; use Illuminate\Http\Request; @@ -61,27 +62,45 @@ class InstallerController extends AppBaseController ]); } + /** + * Check if any of the items has been marked as failed + * @param array $arr + * @return bool + */ + protected function allPassed(array $arr): bool + { + foreach($arr as $item) { + if($item['passed'] === false) { + return false; + } + } + + return true; + } + /** * Step 1. Check the modules and permissions */ public function step1(Request $request) { - $passed = true; $php_version = $this->reqService->checkPHPVersion(); - if($php_version['passed'] === false) { - $passed = false; - } - $extensions = $this->reqService->checkExtensions(); - foreach ($extensions as $ext) { - if($ext['passed'] === false) { - $passed = false; - } - } + $directories = $this->reqService->checkPermissions(); + + # Only pass if all the items in the ext and dirs are passed + $statuses = [ + $php_version['passed'] === true, + $this->allPassed($extensions) === true, + $this->allPassed($directories) === true + ]; + + # Make sure there are no false values + $passed = ! in_array(false, $statuses, true); return view('installer::steps/step1-requirements', [ 'php' => $php_version, 'extensions' => $extensions, + 'directories' => $directories, 'passed' => $passed, ]); } @@ -123,16 +142,16 @@ class InstallerController extends AppBaseController */ public function dbsetup(Request $request) { - $log = []; - - $log[] = 'Creating database'; - $console_out = $this->dbService->setupDB($request->input('db_conn')); + try { + $console_out = $this->dbService->setupDB($request->input('db_conn')); + } catch(QueryException $e) { + flash()->error($e->getMessage()); + return redirect(route('installer.step2')); + } return view('installer::steps/step2a-completed', [ 'console_output' => $console_out ]); - - //return redirect('/'); } /** diff --git a/modules/Installer/Resources/views/app.blade.php b/modules/Installer/Resources/views/app.blade.php index dfea5c51..ce188121 100644 --- a/modules/Installer/Resources/views/app.blade.php +++ b/modules/Installer/Resources/views/app.blade.php @@ -22,6 +22,9 @@ + @yield('css') @@ -44,18 +47,18 @@

-
+{{--
--}}
- @include('flash::message') + @include('installer::flash.message') @yield('content')
diff --git a/modules/Installer/Resources/views/flash/dbtest.blade.php b/modules/Installer/Resources/views/flash/dbtest.blade.php new file mode 100644 index 00000000..710dbec1 --- /dev/null +++ b/modules/Installer/Resources/views/flash/dbtest.blade.php @@ -0,0 +1,8 @@ + diff --git a/modules/Installer/Resources/views/flash/message.blade.php b/modules/Installer/Resources/views/flash/message.blade.php index 6834618f..f21e829a 100644 --- a/modules/Installer/Resources/views/flash/message.blade.php +++ b/modules/Installer/Resources/views/flash/message.blade.php @@ -1,8 +1,11 @@ -