public function update()
{
if (!Utils::isNinjaProd()) {
try {
set_time_limit(60 * 5);
Artisan::call('clear-compiled');
Artisan::call('cache:clear');
Artisan::call('debugbar:clear');
Artisan::call('route:clear');
Artisan::call('view:clear');
Artisan::call('config:clear');
Artisan::call('optimize', ['--force' => true]);
Cache::flush();
Session::flush();
Artisan::call('migrate', ['--force' => true]);
Artisan::call('db:seed', ['--force' => true, '--class' => 'UpdateSeeder']);
Event::fire(new UserSettingsChanged());
// legacy fix: check cipher is in .env file
if (!env('APP_CIPHER')) {
$fp = fopen(base_path() . '/.env', 'a');
fwrite($fp, "\nAPP_CIPHER=rijndael-128");
fclose($fp);
}
// show message with link to Trello board
$message = trans('texts.see_whats_new', ['version' => NINJA_VERSION]);
$message = link_to(RELEASES_URL, $message, ['target' => '_blank']);
$message = sprintf('%s - %s', trans('texts.processed_updates'), $message);
Session::flash('warning', $message);
} catch (Exception $e) {
Utils::logError($e);
return Response::make($e->getMessage(), 500);
}
}
return Redirect::to('/');
}