X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/includes/installer/WebInstallerExistingWiki.php diff --git a/includes/installer/WebInstallerExistingWiki.php b/includes/installer/WebInstallerExistingWiki.php new file mode 100644 index 00000000..df68be8e --- /dev/null +++ b/includes/installer/WebInstallerExistingWiki.php @@ -0,0 +1,191 @@ +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', "
\$wgUpgradeKey = '" . + $this->getVar( 'wgUpgradeKey' ) . "';" )->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'; + } + } + + /** + * Show the "enter key" form + */ + protected function showKeyForm() { + $this->startForm(); + $this->addHTML( + $this->parent->getInfoBox( wfMessage( 'config-localsettings-upgrade' )->plain() ) . + '