available as input for other configuration items, either.
* Remove $wgRemoteUploads. It was not well supported and superseded by
$wgUploadNavigationUrl.
+* $wgUpgradeKey allows unlocking the web installer for upgrades without having
+ to move LocalSettings.php
=== New features in 1.17 ===
* (bug 10183) Users can now add personal styles and scripts to all skins via
*/
$wgReadOnly = null;
-/***
+/**
* If this lock file exists (size > 0), the wiki will be forced into read-only mode.
* Its contents will be shown to users as part of the read-only warning
* message.
*/
$wgReadOnlyFile = false;
+/**
+ * If this is set to some string, this opens up config/index.php for upgrades
+ * when needed. You will need to provide this key to use it
+ */
+$wgUpgradeKey = false;
+
/** @} */ # End of maintenance }
/************************************************************************//**
'_Extensions' => array(),
'_MemCachedServers' => '',
'_ExternalHTTP' => false,
+ '_LocalSettingsLocked' => true,
+ '_UpgradeKey' => '',
);
/**
'config-title' => 'MediaWiki $1 installation',
'config-information' => 'Information',
'config-localsettings-upgrade' => "'''Warning''': A <code>LocalSettings.php</code> file has been detected.
-Your software is able to upgrade.
-Please move <code>LocalSettings.php</code> to somewhere safe and then run the installer again.",
+Your software is able to upgrade. Please fill in the value of <code>\$wgUpgradeKey.php</code> in the box",
+ 'config-localsettings-key' => 'Upgrade key:',
+ 'config-localsettings-badkey' => 'The key you provided is incorrect',
'config-localsettings-noupgrade' => "'''Error''': A <code>LocalSettings.php</code> file has been detected.
Your software is not able to upgrade at this time.
The installer has been disabled for security reasons.",
'config-page-releasenotes' => 'Release notes',
'config-page-copying' => 'Copying',
'config-page-upgradedoc' => 'Upgrading',
+ 'config-page-locked' => 'Permission denied',
'config-help-restart' => 'Do you want to clear all saved data that you have entered and restart the installation process?',
'config-restart' => 'Yes, restart it',
'config-welcome' => "=== Environmental checks ===
wfRestoreWarnings();
if( $ls ) {
- if( $this->getDBInstaller()->needsUpgrade() ) {
+ $wgCacheEpoch = $wgCommandLineMode = false;
+ require_once( "$IP/LocalSettings.php" );
+ $vars = get_defined_vars();
+ if( isset( $vars['wgUpgradeKey'] ) && $vars['wgUpgradeKey'] ) {
$status->warning( 'config-localsettings-upgrade' );
- }
- else {
+ $this->setVar( '_UpgradeKey', $vars['wgUpgradeKey' ] );
+ } else {
$status->fatal( 'config-localsettings-noupgrade' );
}
}
# Get the page name.
$pageName = $this->request->getVal( 'page' );
- if ( in_array( $pageName, $this->otherPages ) ) {
+ # Check LocalSettings status
+ $localSettings = $this->getLocalSettingsStatus();
+
+ if( !$localSettings->isGood() && $this->getVar( '_LocalSettingsLocked' ) ) {
+ $pageName = 'Locked';
+ $pageId = false;
+ $page = $this->getPageByName( $pageName );
+ $page->setLocalSettingsStatus( $localSettings );
+ } elseif ( in_array( $pageName, $this->otherPages ) ) {
# Out of sequence
$pageId = false;
$page = $this->getPageByName( $pageName );
# Execute the page.
$this->currentPageName = $page->getName();
$this->startPageWrapper( $pageName );
- $localSettings = $this->getLocalSettingsStatus();
- if( !$localSettings->isGood() ) {
- $this->showStatusBox( $localSettings );
- $result = 'output';
- } else {
- $result = $page->execute();
- }
+ $result = $page->execute();
$this->endPageWrapper();
}
+class WebInstaller_Locked extends WebInstallerPage {
+
+ // The status of Installer::getLocalSettingsStatus()
+ private $status;
+
+ public function setLocalSettingsStatus( Status $s ) {
+ $this->status = $s;
+ }
+
+ public function execute() {
+ $r = $this->parent->request;
+ if( !$r->wasPosted() || !$this->status->isOK() ) {
+ $this->display();
+ return 'output';
+ } else {
+ $key = $r->getText( 'config_wpUpgradeKey' );
+ if( !$key || $key !== $this->getVar( '_UpgradeKey' ) ) {
+ $this->display( true );
+ return 'output';
+ } else {
+ $this->setVar( '_LocalSettingsLocked', false );
+ return 'continue';
+ }
+ }
+ }
+
+ /**
+ * Display stuff to the end user
+ * @param $badKey bool Whether the key input by the user was bad
+ */
+ private function display( $badKey = false ) {
+ $this->startForm();
+ if( $this->status->isOK() && !$this->status->isGood() ) {
+ if( $badKey ) {
+ $this->parent->showError( 'config-localsettings-badkey' );
+ }
+ $this->parent->output->addWikiText( wfMsg( 'config-localsettings-upgrade' ) );
+ $this->addHTML( "<br />" .
+ $this->parent->getTextBox( array(
+ 'var' => 'wpUpgradeKey',
+ 'label' => 'config-localsettings-key',
+ ) )
+ );
+ } else {
+ $this->parent->showStatusBox( $this->status );
+ }
+ $this->endForm();
+ }
+}
+
class WebInstaller_Language extends WebInstallerPage {
public function execute() {