/** * Main entry point. */ public function execute() { $vars = Installer::getExistingLocalSettings(); if ($vars) { $this->showStatusMessage(Status::newFatal("config-localsettings-cli-upgrade")); } $this->performInstallation(array($this, 'startStage'), array($this, 'endStage')); }
/** * @return string */ public function execute() { // If there is no LocalSettings.php, continue to the installer welcome page $vars = Installer::getExistingLocalSettings(); if (!$vars) { return 'skip'; } // Check if the upgrade key supplied to the user has appeared in LocalSettings.php if ($vars['wgUpgradeKey'] !== false && $this->getVar('_UpgradeKeySupplied') && $this->getVar('wgUpgradeKey') === $vars['wgUpgradeKey']) { // It's there, so the user is authorized $status = $this->handleExistingUpgrade($vars); if ($status->isOK()) { return 'skip'; } else { $this->startForm(); $this->parent->showStatusBox($status); $this->endForm('continue'); return 'output'; } } // If there is no $wgUpgradeKey, tell the user to add one to LocalSettings.php if ($vars['wgUpgradeKey'] === false) { if ($this->getVar('wgUpgradeKey', false) === false) { $secretKey = $this->getVar('wgSecretKey'); // preserve $wgSecretKey $this->parent->generateKeys(); $this->setVar('wgSecretKey', $secretKey); $this->setVar('_UpgradeKeySupplied', true); } $this->startForm(); $this->addHTML($this->parent->getInfoBox(wfMessage('config-upgrade-key-missing', "<pre dir=\"ltr\">\$wgUpgradeKey = '" . $this->getVar('wgUpgradeKey') . "';</pre>")->plain())); $this->endForm('continue'); return 'output'; } // If there is an upgrade key, but it wasn't supplied, prompt the user to enter it $r = $this->parent->request; if ($r->wasPosted()) { $key = $r->getText('config_wgUpgradeKey'); if (!$key || $key !== $vars['wgUpgradeKey']) { $this->parent->showError('config-localsettings-badkey'); $this->showKeyForm(); return 'output'; } // Key was OK $status = $this->handleExistingUpgrade($vars); if ($status->isOK()) { return 'continue'; } else { $this->parent->showStatusBox($status); $this->showKeyForm(); return 'output'; } } else { $this->showKeyForm(); return 'output'; } }
/** * Loads LocalSettings.php, if needed, and initialises everything needed for * LoadExtensionSchemaUpdates hook. */ private function loadExtensions() { if (!defined('MEDIAWIKI_INSTALL')) { return; // already loaded } $vars = Installer::getExistingLocalSettings(); if (!$vars) { return; // no LocalSettings found } if (!isset($vars['wgHooks']) || !isset($vars['wgHooks']['LoadExtensionSchemaUpdates'])) { return; } global $wgHooks, $wgAutoloadClasses; $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates']; $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses']; }
/** * Loads LocalSettings.php, if needed, and initialises everything needed for * LoadExtensionSchemaUpdates hook. */ private function loadExtensions() { if (!defined('MEDIAWIKI_INSTALL')) { return; // already loaded } $vars = Installer::getExistingLocalSettings(); $registry = ExtensionRegistry::getInstance(); $queue = $registry->getQueue(); // Don't accidentally load extensions in the future $registry->clearQueue(); // This will automatically add "AutoloadClasses" to $wgAutoloadClasses $data = $registry->readFromQueue($queue); $hooks = array('wgHooks' => array('LoadExtensionSchemaUpdates' => array())); if (isset($data['globals']['wgHooks']['LoadExtensionSchemaUpdates'])) { $hooks = $data['globals']['wgHooks']['LoadExtensionSchemaUpdates']; } if ($vars && isset($vars['wgHooks']['LoadExtensionSchemaUpdates'])) { $hooks = array_merge_recursive($hooks, $vars['wgHooks']['LoadExtensionSchemaUpdates']); } global $wgHooks, $wgAutoloadClasses; $wgHooks['LoadExtensionSchemaUpdates'] = $hooks; if ($vars && isset($vars['wgAutoloadClasses'])) { $wgAutoloadClasses += $vars['wgAutoloadClasses']; } }