mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 20:37:29 -05:00 
			
		
		
		
	* Fixes for white label * Include Laravel Horizon * Add Account ID to user table AND ensure a user cannot create an invoice across companies * restart horison after an update * Fixes for app setup * Minor fixes * Fixes for client routes * Fixes for tests * minor fixes
		
			
				
	
	
		
			79 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Console\Commands;
 | 
						|
 | 
						|
use Illuminate\Console\Command;
 | 
						|
use Illuminate\Support\Facades\Artisan;
 | 
						|
use Composer\Console\Application;
 | 
						|
use Symfony\Component\Console\Input\ArrayInput;
 | 
						|
 | 
						|
class ArtisanUpgrade extends Command
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * The name and signature of the console command.
 | 
						|
     *
 | 
						|
     * @var string
 | 
						|
     */
 | 
						|
    protected $signature = 'ninja:post-update';
 | 
						|
 | 
						|
    /**
 | 
						|
     * The console command description.
 | 
						|
     *
 | 
						|
     * @var string
 | 
						|
     */
 | 
						|
    protected $description = 'Run basic upgrade commands';
 | 
						|
 | 
						|
    /**
 | 
						|
     * Create a new command instance.
 | 
						|
     *
 | 
						|
     * @return void
 | 
						|
     */
 | 
						|
    public function __construct()
 | 
						|
    {
 | 
						|
        parent::__construct();
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Execute the console command.
 | 
						|
     *
 | 
						|
     * @return mixed
 | 
						|
     */
 | 
						|
    public function handle()
 | 
						|
    {
 | 
						|
        set_time_limit(0);
 | 
						|
 | 
						|
        try {
 | 
						|
            Artisan::call('migrate');
 | 
						|
        } catch (Exception $e) {
 | 
						|
            \Log::error("I wasn't able to migrate the data.");
 | 
						|
        }
 | 
						|
 | 
						|
        try {
 | 
						|
            Artisan::call('optimize');
 | 
						|
        } catch (Exception $e) {
 | 
						|
            \Log::error("I wasn't able to optimize.");
 | 
						|
        }
 | 
						|
 | 
						|
        // try {
 | 
						|
        //     Artisan::call('queue:restart');
 | 
						|
        // } catch (Exception $e) {
 | 
						|
        //     \Log::error("I wasn't able to restart the queue");
 | 
						|
        // }
 | 
						|
    
 | 
						|
        try {
 | 
						|
            /* Restart Horizon */
 | 
						|
            Artisan::call('horizon:terminate');
 | 
						|
            Artisan::call('horizon');
 | 
						|
        } catch (Exception $e) {
 | 
						|
            \Log::error("I wasn't able to start horizon");
 | 
						|
        }
 | 
						|
 | 
						|
        putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
 | 
						|
        $input = new ArrayInput(array('command' => 'install'));
 | 
						|
        $application = new Application();
 | 
						|
        //$application->setAutoExit(false); // prevent `$application->run` method from exitting the script
 | 
						|
        $application->run($input);
 | 
						|
 | 
						|
    }
 | 
						|
}
 |