diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4d78745..d7e3d17 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -53,6 +53,15 @@ class AppServiceProvider extends ServiceProvider { LengthAwarePaginator::defaultView($themeHelper->viewName('partials.pager_links')); } + + // Set base URL variable (used in both the main app and the installer) + $baseUrl = url('/'); + if (!substr($baseUrl, strlen($baseUrl) - 1, 1) != '/') + { + $baseUrl .= '/'; + } + + View::share('appBaseUrl', $baseUrl); } /** diff --git a/public/install.php b/public/install.php index 8fed6ec..44e5ba6 100644 --- a/public/install.php +++ b/public/install.php @@ -11,6 +11,7 @@ class BlueTwilightInstaller { $this->baseDirectory = dirname(__DIR__); chdir($this->baseDirectory); + putenv('HOME=' . $this->baseDirectory); // Display errors so installer never gets a WSOD! ini_set('display_errors', true); @@ -25,19 +26,27 @@ class BlueTwilightInstaller exit(); } ?> -
We need to download a few things - namely Composer and related packages - before we can kick off the Blue Twilight installer.
-We can do this for you - simply click the button below.
- + + +We need to download a few things - namely Composer and related packages - before we can kick off the Blue Twilight installer.
+We can do this for you - simply click the button below.
+This can take a few minutes so please be patient!
+ -If you already have Composer installed, however, you may want to use that instead. Just run the below commands on your server, changing the path to Composer as appropriate:
-Please note: "composer.phar" may actually be "composer" on your system.
-cd baseDirectory; ?>+
/path/to/composer.phar install
If you already have Composer installed, however, you may want to use that instead. Just run the below commands on your server, changing the path to Composer as appropriate:
+Please note: "composer.phar" may actually be "composer" on your system.
+cd baseDirectory; ?>+ + %s...%s", $step[0], PHP_EOL); @@ -62,15 +74,49 @@ class BlueTwilightInstaller if (!$result) { + $successful = false; break; } } + if ($successful) + { + header('Location: install/check'); + exit(); + } + ?> 0) + { + $this->echoError(sprintf('The following PHP modules are missing and need to be installed to continue: %s', join(', ', $invalidModules))); + return false; + } + + return true; + } + private function echoError($message) { echo sprintf("%s.%s", $message, PHP_EOL); @@ -105,11 +151,42 @@ class BlueTwilightInstaller return true; } + private function generateAppKey() + { + if (!file_exists('.env') && file_exists('.env.example')) + { + copy('.env.example', '.env'); + } + + ob_start(); + system('touch .env', $rc); + $result = ob_get_clean(); + echo nl2br($result); + + ob_start(); + system('php artisan key:generate', $rc); + $result = ob_get_clean(); + echo nl2br($result); + + if ($rc != 0) + { + $this->echoError('Failed to generate application key'); + return false; + } + + $this->echoOK(); + return true; + } + private function installComposer() { $rc = -1; + ob_start(); system('php -r "copy(\'https://getcomposer.org/installer\', \'composer-setup.php\');"', $rc); + $result = ob_get_clean(); + echo nl2br($result); + if ($rc != 0) { $this->echoError('Failed to fetch Composer'); diff --git a/resources/views/install/layout.blade.php b/resources/views/install/layout.blade.php index 0d7026d..be00d72 100644 --- a/resources/views/install/layout.blade.php +++ b/resources/views/install/layout.blade.php @@ -7,7 +7,7 @@
/path/to/composer.phar install