Support no database existing when october:util set build is run

This fixes an issue when composer automatically calls the `php artisan october:util set build` command after installing dependencies but before a database has been initialized for October.
This commit is contained in:
Luke Towers 2017-08-13 15:53:19 -06:00
parent 7c3d4705fc
commit cf6ca02886
1 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
<?php namespace System\Console;
use App;
use Lang;
use File;
use Config;
@ -25,6 +26,7 @@ use Exception;
* - compile less: Compile registered LESS files only.
* - compile scss: Compile registered SCSS files only.
* - compile lang: Compile registered Language files only.
* - set build: Pull the latest stable build number from the update gateway and set it as the current build number.
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
@ -115,6 +117,14 @@ class OctoberUtil extends Command
{
$this->comment('-');
/*
* Skip setting the build number if no database is detected to set it within
*/
if (!App::hasDatabase()) {
$this->comment('No database detected - skipping setting the build number.');
return;
}
try {
$build = UpdateManager::instance()->setBuildNumberManually();
$this->comment('*** October sets build: '.$build);