mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Check for APP_ENV
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
070c36ffe6
commit
8d9cdf9c15
39
upgrade.php
39
upgrade.php
|
@ -15,6 +15,7 @@ if ((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') || (!function_exists('posix_get
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$app_environment = 'develop';
|
||||||
|
|
||||||
// Check if a branch or tag was passed in the command line,
|
// Check if a branch or tag was passed in the command line,
|
||||||
// otherwise just use master
|
// otherwise just use master
|
||||||
|
@ -58,6 +59,26 @@ foreach ($env as $line_num => $line) {
|
||||||
|
|
||||||
$env_value = trim($env_value);
|
$env_value = trim($env_value);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We set this $app_environment here to determine which version of composer to use, --no-dev or with dev dependencies.
|
||||||
|
* This doesn't actually *change* anything in the .env file, but if the user is running this with
|
||||||
|
* APP_ENV set to anything OTHER than production, they'll get an error when they try to dump-autoload
|
||||||
|
* because the Dusk service provider only tries to load if the app is not in production mode.
|
||||||
|
*
|
||||||
|
* It's 100% okay if they're not in production mode, but this will avoid any confusion as they get
|
||||||
|
* erroneous errors using this upgrader if they are not in production mode when they run this script.
|
||||||
|
*
|
||||||
|
* We use this further down in the composer section of this upgrader.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($env_key == "APP_ENV") {
|
||||||
|
if ($env_value == 'production') {
|
||||||
|
$app_environment = 'production';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($env_key == 'APP_KEY') {
|
if ($env_key == 'APP_KEY') {
|
||||||
if (($env_value=='') || (strlen($env_value) < 20)) {
|
if (($env_value=='') || (strlen($env_value) < 20)) {
|
||||||
$env_bad .= "✘ APP_KEY ERROR in your .env on line #'.$show_line_num.': Your APP_KEY should not be blank. Run `php artisan key:generate` to generate one.\n";
|
$env_bad .= "✘ APP_KEY ERROR in your .env on line #'.$show_line_num.': Your APP_KEY should not be blank. Run `php artisan key:generate` to generate one.\n";
|
||||||
|
@ -354,12 +375,26 @@ if (file_exists('composer.phar')) {
|
||||||
echo $composer_update."\n\n";
|
echo $composer_update."\n\n";
|
||||||
|
|
||||||
$composer_dump = shell_exec('php composer.phar dump');
|
$composer_dump = shell_exec('php composer.phar dump');
|
||||||
$composer = shell_exec('php composer.phar install --no-dev --prefer-source');
|
|
||||||
|
// Use --no-dev only if we are in production mode.
|
||||||
|
// This will cause errors otherwise, if the user is in develop or local for their APP_ENV
|
||||||
|
if ($app_environment == 'production') {
|
||||||
|
$composer = shell_exec('php composer.phar install --no-dev --prefer-source');
|
||||||
|
} else {
|
||||||
|
$composer = shell_exec('php composer.phar install --prefer-source');
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
echo "-- We couldn't find a local composer.phar. No worries, trying globally.\n\n";
|
echo "-- We couldn't find a local composer.phar. No worries, trying globally.\n\n";
|
||||||
$composer_dump = shell_exec('composer dump');
|
$composer_dump = shell_exec('composer dump');
|
||||||
$composer = shell_exec('composer install --no-dev --prefer-source');
|
|
||||||
|
if ($app_environment == 'production') {
|
||||||
|
$composer = shell_exec('composer install --no-dev --prefer-source');
|
||||||
|
} else {
|
||||||
|
$composer = shell_exec('composer install --prefer-source');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $composer_dump."\n";
|
echo $composer_dump."\n";
|
||||||
|
|
Loading…
Reference in a new issue