本文整理汇总了PHP中Installer::getExistingLocalSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP Installer::getExistingLocalSettings方法的具体用法?PHP Installer::getExistingLocalSettings怎么用?PHP Installer::getExistingLocalSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Installer
的用法示例。
在下文中一共展示了Installer::getExistingLocalSettings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* 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'));
}
示例2: execute
/**
* @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';
}
}
示例3: loadExtensions
/**
* 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'];
}
示例4: loadExtensions
/**
* 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'];
}
}