From abd2d8e8e28886484312dcb76f7f5c0f1ee15970 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Sun, 17 Dec 2017 11:29:11 -0600 Subject: [PATCH] Rewrite rules and block installed if it's already installed --- .gitignore | 3 +++ .htaccess | 2 ++ Procfile | 2 +- .../Http/Controllers/InstallerController.php | 4 ++++ .../views/errors/already-installed.blade.php | 11 +++++++++++ public/{index.php => index.php.bak} | 0 6 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 modules/Installer/Resources/views/errors/already-installed.blade.php rename public/{index.php => index.php.bak} (100%) diff --git a/.gitignore b/.gitignore index 1c8f8c87..1afd6663 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ _ide_helper.php node_modules/ npm-debug.log +*.bak + # Laravel 4 specific bootstrap/compiled.php app/storage/ @@ -23,6 +25,7 @@ env.php .vagrant #Homestead.yaml Homestead.json +LocalValetDriver.php # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer .rocketeer/ diff --git a/.htaccess b/.htaccess index 0ff7906a..6db69bfe 100755 --- a/.htaccess +++ b/.htaccess @@ -34,6 +34,8 @@ Options -Indexes RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] + RewriteRule ^(.*)$ public/$1 [L] + # Handle Authorization Header RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] diff --git a/Procfile b/Procfile index 482c74b1..9023b9fe 100644 --- a/Procfile +++ b/Procfile @@ -1,4 +1,4 @@ dnsmasq: /usr/local/sbin/dnsmasq --keep-in-foreground php-fpm: /usr/local/sbin/php-fpm --nodaemonize nginx: /usr/local/bin/nginx -mysql: /usr/local/bin/mysqld --log-slow-queries +mysql: /usr/local/bin/mysqld diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index c76705cb..2124c6ec 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -31,6 +31,10 @@ class InstallerController extends AppBaseController */ public function index() { + if(config('app.key') !== 'NOT_INSTALLED') { + return view('installer::errors/already-installed'); + } + return view('installer::index-start'); } diff --git a/modules/Installer/Resources/views/errors/already-installed.blade.php b/modules/Installer/Resources/views/errors/already-installed.blade.php new file mode 100644 index 00000000..5977847d --- /dev/null +++ b/modules/Installer/Resources/views/errors/already-installed.blade.php @@ -0,0 +1,11 @@ +@extends('installer::app') + +@section('content') +

phpVMS already installed!

+

phpVMS has already been installed! Please remove the modules/Installer folder.

+ {!! Form::open(['url' => '/', 'method' => 'get']) !!} +

+ {!! Form::submit('Go to your site >>', ['class' => 'btn btn-success']) !!} +

+ {!! Form::close() !!} +@endsection diff --git a/public/index.php b/public/index.php.bak similarity index 100% rename from public/index.php rename to public/index.php.bak