1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Fixes for self updater (#3621)

This commit is contained in:
David Bomba 2020-04-11 21:48:38 +10:00 committed by GitHub
parent ba55cc32e1
commit 9138980cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,11 @@ namespace App\Http\Controllers;
use App\Utils\Ninja;
use Codedge\Updater\UpdaterManager;
use Composer\Factory;
use Composer\IO\NullIO;
use Composer\Installer;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Storage;
class SelfUpdateController extends BaseController
@ -64,6 +68,27 @@ class SelfUpdateController extends BaseController
$res = $updater->update();
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.");
}
$composer = Factory::create(new NullIO(), base_path('composer.json'), false);
$output = Installer::create(new NullIO, $composer)
->setVerbose()
->setUpdate(true)
->run();
\Log::error(print_r($output,1));
return response()->json(['message'=>$res], 200);
}
}