public function runUpdaterAndExit($doDryRun = null)
{
$updater = new DbUpdater();
$componentsWithUpdateFile = $updater->getComponentUpdates();
if (empty($componentsWithUpdateFile)) {
throw new NoUpdatesFoundException("Everything is already up to date.");
}
SettingsServer::setMaxExecutionTime(0);
$welcomeTemplate = '@CoreUpdater/runUpdaterAndExit_welcome';
$doneTemplate = '@CoreUpdater/runUpdaterAndExit_done';
$viewWelcome = new View($welcomeTemplate);
$this->addCustomLogoInfo($viewWelcome);
$this->setBasicVariablesView($viewWelcome);
$viewDone = new View($doneTemplate);
$this->addCustomLogoInfo($viewDone);
$this->setBasicVariablesView($viewDone);
$doExecuteUpdates = Common::getRequestVar('updateCorePlugins', 0, 'integer') == 1;
if (is_null($doDryRun)) {
$doDryRun = !$doExecuteUpdates;
}
if ($doDryRun) {
$viewWelcome->queries = $updater->getSqlQueriesToExecute();
$viewWelcome->isMajor = $updater->hasMajorDbUpdate();
$this->doWelcomeUpdates($viewWelcome, $componentsWithUpdateFile);
return $viewWelcome->render();
}
// Web
if ($doExecuteUpdates) {
$this->warningMessages = array();
$this->doExecuteUpdates($viewDone, $updater, $componentsWithUpdateFile);
$this->redirectToDashboardWhenNoError($updater);
return $viewDone->render();
}
exit;
}