public function updateAction()
{
if (!($file = App::session()->get('system.update'))) {
App::abort(400, __('You may not call this step directly.'));
}
App::session()->remove('system.update');
return App::response()->stream(function () use($file) {
$output = new StreamOutput(fopen('php://output', 'w'));
try {
if (!file_exists($file) || !is_file($file)) {
throw new \RuntimeException('File does not exist.');
}
$updater = new SelfUpdater($output);
$updater->update($file);
} catch (\Exception $e) {
$output->writeln(sprintf("\n<error>%s</error>", $e->getMessage()));
$output->write("status=error");
}
});
}