From b97b47cd8c705adb5e0f2cfad5164ebb6d3f5ced Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 15 Dec 2017 11:22:46 -0600 Subject: [PATCH] Add some error state pages and installer fixes --- app/Http/Controllers/HomeController.php | 8 +- config/phpvms.php | 5 ++ .../Http/Controllers/InstallerController.php | 2 +- .../Resources/views/stubs/env.blade.php | 4 +- .../Installer/Services/EnvironmentService.php | 2 +- .../system/errors/database_error.blade.php | 75 +++++++++++++++++++ .../system/errors/not_installed.blade.php | 72 ++++++++++++++++++ 7 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 resources/views/system/errors/database_error.blade.php create mode 100644 resources/views/system/errors/not_installed.blade.php diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 5797eb9e..d9072dbb 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use App\Models\User; +use Illuminate\Database\QueryException; class HomeController extends AppBaseController { @@ -11,7 +12,12 @@ class HomeController extends AppBaseController */ public function index() { - $users = User::orderBy('created_at', 'desc')->take(4)->get(); + try { + $users = User::orderBy('created_at', 'desc')->take(4)->get(); + } catch (QueryException $e) { + return view('system/errors/not_installed'); + } + return $this->view('home', [ 'users' => $users, ]); diff --git a/config/phpvms.php b/config/phpvms.php index a5616227..74cad56c 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -11,6 +11,11 @@ return [ + /** + * Check for if we're "installed" or not + */ + 'installed' => env('PHPVMS_INSTALLED', false), + /** * The skin to use for the front-end */ diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index 7fff0358..c76705cb 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -56,7 +56,7 @@ class InstallerController extends AppBaseController $message = 'Failed! ' . $e->getMessage(); } - return view('installer::flash/message', [ + return view('installer::flash/dbtest', [ 'status' => $status, 'message' => $message, ]); diff --git a/modules/Installer/Resources/views/stubs/env.blade.php b/modules/Installer/Resources/views/stubs/env.blade.php index 341b4b32..6779730c 100644 --- a/modules/Installer/Resources/views/stubs/env.blade.php +++ b/modules/Installer/Resources/views/stubs/env.blade.php @@ -6,11 +6,13 @@ APP_ENV={!! $APP_ENV !!} APP_URL=http://localhost APP_SKIN=default -VACENTRAL_API_KEY= APP_KEY=base64:{!! $APP_KEY !!} APP_DEBUG=true APP_LOCALE=en +PHPVMS_INSTALLED=true +VACENTRAL_API_KEY= + APP_LOG=daily APP_LOG_LEVEL=debug APP_LOG_MAX_FILES=3 diff --git a/modules/Installer/Services/EnvironmentService.php b/modules/Installer/Services/EnvironmentService.php index 6780a2b3..0f0817a6 100644 --- a/modules/Installer/Services/EnvironmentService.php +++ b/modules/Installer/Services/EnvironmentService.php @@ -51,7 +51,7 @@ class EnvironmentService if(\extension_loaded('apc')) { $opts['CACHE_DRIVER'] = 'apc'; } else { - $opts['CACHE_DRIVER'] = 'file'; + $opts['CACHE_DRIVER'] = 'array'; } return $opts; diff --git a/resources/views/system/errors/database_error.blade.php b/resources/views/system/errors/database_error.blade.php new file mode 100644 index 00000000..7f294372 --- /dev/null +++ b/resources/views/system/errors/database_error.blade.php @@ -0,0 +1,75 @@ + + + + + + + + + @yield('title') - installer + + + + + + + + + {{----}} + + + + + @yield('css') + + + + + + +{{--
--}} +
+
+
+
+
+

Database Error

+ @yield('content') +
+
+
+
+
+ +@yield('scripts') + + + diff --git a/resources/views/system/errors/not_installed.blade.php b/resources/views/system/errors/not_installed.blade.php new file mode 100644 index 00000000..094905a1 --- /dev/null +++ b/resources/views/system/errors/not_installed.blade.php @@ -0,0 +1,72 @@ + + + + + + + + + welcome to phpvms + + + + + + + + + @yield('css') + + + + + + +{{--
--}} +
+
+
+
+
+

phpVMS Not Installed

+

+ Head on to the installer > +

+ @yield('content') +
+
+
+
+
+ +@yield('scripts') + + +