diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index 5a48a5b460..dc3fdcf20f 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -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); } }