Localisation updates for core and extension messages from translatewiki.net (2011...
[lhc/web/wiklou.git] / includes / installer / WebInstallerPage.php
index 16fe626..1d3daf2 100644 (file)
@@ -20,9 +20,9 @@ abstract class WebInstallerPage {
         * @var WebInstaller
         */
        public $parent;
-       
+
        public abstract function execute();
-       
+
        /**
         * Constructor.
         *
@@ -52,17 +52,17 @@ abstract class WebInstallerPage {
        public function endForm( $continue = 'continue', $back = 'back' ) {
                $s = "<div class=\"config-submit\">\n";
                $id = $this->getId();
-               
+
                if ( $id === false ) {
                        $s .= Html::hidden( 'lastPage', $this->parent->request->getVal( 'lastPage' ) );
                }
-               
+
                if ( $continue ) {
                        // Fake submit button for enter keypress (bug 26267)
                        $s .= Xml::submitButton( wfMsg( "config-$continue" ),
                                array( 'name' => "enter-$continue", 'style' => 'visibility:hidden;overflow:hidden;width:1px;margin:0' ) ) . "\n";
                }
-               
+
                if ( $back ) {
                        $s .= Xml::submitButton( wfMsg( "config-$back" ),
                                array(
@@ -70,7 +70,7 @@ abstract class WebInstallerPage {
                                        'tabindex' => $this->parent->nextTabIndex()
                                ) ) . "\n";
                }
-               
+
                if ( $continue ) {
                        $s .= Xml::submitButton( wfMsg( "config-$continue" ),
                                array(
@@ -78,7 +78,7 @@ abstract class WebInstallerPage {
                                        'tabindex' => $this->parent->nextTabIndex(),
                                ) ) . "\n";
                }
-               
+
                $s .= "</div></form></div>\n";
                $this->addHTML( $s );
        }
@@ -114,10 +114,31 @@ abstract class WebInstallerPage {
        protected function getFieldsetEnd() {
                return "</fieldset>\n";
        }
+
+       /**
+        * Opens a textarea used to display the progress of a long operation
+        */
+       protected function startLiveBox() {
+               $this->addHTML(
+                       '<div id="config-spinner" style="display:none;"><img src="../skins/common/images/ajax-loader.gif" /></div>' .
+                       '<script>jQuery( "#config-spinner" ).show();</script>' .
+                       '<textarea id="config-live-log" name="LiveLog" rows="10" cols="30" readonly="readonly">'
+               );
+               $this->parent->output->flush();
+       }
+
+       /**
+        * Opposite to startLiveBox()
+        */
+       protected function endLiveBox() {
+               $this->addHTML( '</textarea>
+<script>jQuery( "#config-spinner" ).hide()</script>' );
+               $this->parent->output->flush();
+       }
 }
 
 class WebInstaller_Language extends WebInstallerPage {
-       
+
        public function execute() {
                global $wgLang;
                $r = $this->parent->request;
@@ -192,7 +213,7 @@ class WebInstaller_Language extends WebInstallerPage {
                $s .= "\n</select>\n";
                return $this->parent->label( $label, $name, $s );
        }
-       
+
 }
 
 class WebInstaller_ExistingWiki extends WebInstallerPage {
@@ -206,7 +227,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                // 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'] ) 
+                       && $this->getVar( 'wgUpgradeKey' ) === $vars['wgUpgradeKey'] )
                {
                        // It's there, so the user is authorized
                        $status = $this->handleExistingUpgrade( $vars );
@@ -218,7 +239,6 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                                $this->endForm( 'continue' );
                                return 'output';
                        }
-                       return $this->handleExistingUpgrade( $vars );
                }
 
                // If there is no $wgUpgradeKey, tell the user to add one to LocalSettings.php
@@ -228,8 +248,8 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                                $this->setVar( '_UpgradeKeySupplied', true );
                        }
                        $this->startForm();
-                       $this->addHTML( $this->parent->getInfoBox( 
-                               wfMsgNoTrans( 'config-upgrade-key-missing', 
+                       $this->addHTML( $this->parent->getInfoBox(
+                               wfMsgNoTrans( 'config-upgrade-key-missing',
                                        "<pre>\$wgUpgradeKey = '" . $this->getVar( 'wgUpgradeKey' ) . "';</pre>" )
                        ) );
                        $this->endForm( 'continue' );
@@ -237,7 +257,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                }
 
                // 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' );
@@ -266,7 +286,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
         */
        protected function showKeyForm() {
                $this->startForm();
-               $this->addHTML( 
+               $this->addHTML(
                        $this->parent->getInfoBox( wfMsgNoTrans( 'config-localsettings-upgrade' ) ).
                        '<br />' .
                        $this->parent->getTextBox( array(
@@ -301,7 +321,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                }
 
                // Set the relevant variables from LocalSettings.php
-               $requiredVars = array( 'wgDBtype', 'wgDBuser', 'wgDBpassword' );
+               $requiredVars = array( 'wgDBtype' );
                $status = $this->importVariables( $requiredVars , $vars );
                $installer = $this->parent->getDBInstaller();
                $status->merge( $this->importVariables( $installer->getGlobalNames(), $vars ) );
@@ -324,7 +344,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                $status = $installer->getConnection();
                if ( !$status->isOK() ) {
                        // Adjust the error message to explain things correctly
-                       $status->replaceMessage( 'config-connection-error', 
+                       $status->replaceMessage( 'config-connection-error',
                                'config-localsettings-connection-error' );
                        return $status;
                }
@@ -336,7 +356,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
 }
 
 class WebInstaller_Welcome extends WebInstallerPage {
-       
+
        public function execute() {
                if ( $this->parent->request->wasPosted() ) {
                        if ( $this->getVar( '_Environment' ) ) {
@@ -345,18 +365,22 @@ class WebInstaller_Welcome extends WebInstallerPage {
                }
                $this->parent->output->addWikiText( wfMsgNoTrans( 'config-welcome' ) );
                $status = $this->parent->doEnvironmentChecks();
-               if ( $status ) {
+               if ( $status->isGood() ) {
+                       $this->parent->output->addHTML( '<span class="success-message">' .
+                               wfMsgHtml( 'config-env-good' ) . '</span>' );
                        $this->parent->output->addWikiText( wfMsgNoTrans( 'config-copyright',
                                SpecialVersion::getCopyrightAndAuthorList() ) );
                        $this->startForm();
                        $this->endForm();
+               } else {
+                       $this->parent->showStatusMessage( $status );
                }
        }
-       
+
 }
 
 class WebInstaller_DBConnect extends WebInstallerPage {
-       
+
        public function execute() {
                if ( $this->getVar( '_ExistingDBSettings' ) ) {
                        return 'skip';
@@ -365,6 +389,7 @@ class WebInstaller_DBConnect extends WebInstallerPage {
                $r = $this->parent->request;
                if ( $r->wasPosted() ) {
                        $status = $this->submit();
+
                        if ( $status->isGood() ) {
                                $this->setVar( '_UpgradeDone', false );
                                return 'continue';
@@ -381,9 +406,8 @@ class WebInstaller_DBConnect extends WebInstallerPage {
 
                $dbSupport = '';
                foreach( $this->parent->getDBTypes() as $type ) {
-                       $db = 'Database' . ucfirst( $type );
-                       $dbSupport .= wfMsgNoTrans( "config-support-$type",
-                               call_user_func( array( $db, 'getSoftwareLink' ) ) ) . "\n";
+                       $link = DatabaseBase::newFromType( $type )->getSoftwareLink();
+                       $dbSupport .= wfMsgNoTrans( "config-support-$type", $link ) . "\n";
                }
                $this->addHTML( $this->parent->getInfoBox(
                        wfMsg( 'config-support-info', $dbSupport ) ) );
@@ -428,14 +452,14 @@ class WebInstaller_DBConnect extends WebInstallerPage {
                }
                return $installer->submitConnectForm();
        }
-       
+
 }
 
 class WebInstaller_Upgrade extends WebInstallerPage {
-       
+
        public function execute() {
                if ( $this->getVar( '_UpgradeDone' ) ) {
-                       // Allow regeneration of LocalSettings.php, unless we are working 
+                       // Allow regeneration of LocalSettings.php, unless we are working
                        // from a pre-existing LocalSettings.php file and we want to avoid
                        // leaking its contents
                        if ( $this->parent->request->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) {
@@ -461,17 +485,17 @@ class WebInstaller_Upgrade extends WebInstallerPage {
 
                if ( $this->parent->request->wasPosted() ) {
                        $installer->preUpgrade();
-                       $this->addHTML(
-                               '<div id="config-spinner" style="display:none;"><img src="../skins/common/images/ajax-loader.gif" /></div>' .
-                               '<script>jQuery( "#config-spinner" )[0].style.display = "block";</script>' .
-                               '<textarea id="config-update-log" name="UpdateLog" rows="10" readonly="readonly">'
-                       );
-                       $this->parent->output->flush();
+
+                       $this->startLiveBox();
                        $result = $installer->doUpgrade();
-                       $this->addHTML( '</textarea>
-<script>jQuery( "#config-spinner" )[0].style.display = "none";</script>' );
-                       $this->parent->output->flush();
+                       $this->endLiveBox();
+
                        if ( $result ) {
+                               // If they're going to possibly regenerate LocalSettings, we
+                               // need to create the upgrade/secret keys. Bug 26481
+                               if( !$this->getVar( '_ExistingDBSettings' ) ) {
+                                       $this->parent->generateKeys();
+                               }
                                $this->setVar( '_UpgradeDone', true );
                                $this->showDoneMessage();
                                return 'output';
@@ -505,11 +529,11 @@ class WebInstaller_Upgrade extends WebInstallerPage {
                $this->parent->restoreLinkPopups();
                $this->endForm( $regenerate ? 'regenerate' : false, false );
        }
-       
+
 }
 
 class WebInstaller_DBSettings extends WebInstallerPage {
-       
+
        public function execute() {
                $installer = $this->parent->getDBInstaller( $this->getVar( 'wgDBtype' ) );
 
@@ -538,7 +562,7 @@ class WebInstaller_DBSettings extends WebInstallerPage {
 }
 
 class WebInstaller_Name extends WebInstallerPage {
-       
+
        public function execute() {
                $r = $this->parent->request;
                if ( $r->wasPosted() ) {
@@ -549,7 +573,11 @@ class WebInstaller_Name extends WebInstallerPage {
 
                $this->startForm();
 
-               if ( $this->getVar( 'wgSitename' ) == $GLOBALS['wgSitename'] ) {
+               // Encourage people to not name their site 'MediaWiki' by blanking the
+               // field. I think that was the intent with the original $GLOBALS['wgSitename']
+               // but these two always were the same so had the effect of making the
+               // installer forget $wgSitename when navigating back to this page.
+               if ( $this->getVar( 'wgSitename' ) == 'MediaWiki' ) {
                        $this->setVar( 'wgSitename', '' );
                }
 
@@ -576,7 +604,7 @@ class WebInstaller_Name extends WebInstallerPage {
                                'var' => 'wgMetaNamespace',
                                'label' => '', //TODO: Needs a label?
                                'attribs' => array( 'readonly' => 'readonly', 'class' => 'enabledByOther' ),
-                           
+
                        ) ) .
                        $this->getFieldSetStart( 'config-admin-box' ) .
                        $this->parent->getTextBox( array(
@@ -595,12 +623,12 @@ class WebInstaller_Name extends WebInstallerPage {
                        $this->parent->getTextBox( array(
                                'var' => '_AdminEmail',
                                'label' => 'config-admin-email',
-                           'help' => $this->parent->getHelpBox( 'config-admin-email-help' )
+                               'help' => $this->parent->getHelpBox( 'config-admin-email-help' )
                        ) ) .
                        $this->parent->getCheckBox( array(
                                'var' => '_Subscribe',
                                'label' => 'config-subscribe',
-                           'help' => $this->parent->getHelpBox( 'config-subscribe-help' )
+                               'help' => $this->parent->getHelpBox( 'config-subscribe-help' )
                        ) ) .
                        $this->getFieldSetEnd() .
                        $this->parent->getInfoBox( wfMsg( 'config-almost-done' ) ) .
@@ -622,7 +650,7 @@ class WebInstaller_Name extends WebInstallerPage {
                $retVal = true;
                $this->parent->setVarsFromRequest( array( 'wgSitename', '_NamespaceType',
                        '_AdminName', '_AdminPassword', '_AdminPassword2', '_AdminEmail',
-                       '_Subscribe', '_SkipOptional' ) );
+                       '_Subscribe', '_SkipOptional', 'wgMetaNamespace' ) );
 
                // Validate site name
                if ( strval( $this->getVar( 'wgSitename' ) ) === '' ) {
@@ -663,6 +691,15 @@ class WebInstaller_Name extends WebInstallerPage {
                        $this->parent->showError( 'config-ns-invalid', $name );
                        $retVal = false;
                }
+
+               // Make sure it won't conflict with any existing namespaces
+               global $wgContLang;
+               $nsIndex = $wgContLang->getNsIndex( $name );
+               if( $nsIndex !== false && $nsIndex !== NS_PROJECT ) {
+                       $this->parent->showError( 'config-ns-conflict', $name );
+                       $retVal = false;
+               }
+
                $this->setVar( 'wgMetaNamespace', $name );
 
                // Validate username for creation
@@ -699,18 +736,26 @@ class WebInstaller_Name extends WebInstallerPage {
                        $msg = $valid;
                }
                if ( $msg !== false ) {
-                       $this->parent->showError( $msg );
+                       call_user_func_array( array( $this->parent, 'showError' ), (array)$msg );
                        $this->setVar( '_AdminPassword', '' );
                        $this->setVar( '_AdminPassword2', '' );
                        $retVal = false;
                }
+
+               // Validate e-mail if provided
+               $email = $this->getVar( '_AdminEmail' );
+               if( $email && !User::isValidEmailAddr( $email ) ) {
+                       $this->parent->showError( 'config-admin-error-bademail' );
+                       $retVal = false;
+               }
+
                return $retVal;
        }
-       
+
 }
 
 class WebInstaller_Options extends WebInstallerPage {
-       
+
        public function execute() {
                if ( $this->getVar( '_SkipOptional' ) == 'skip' ) {
                        return 'skip';
@@ -721,6 +766,7 @@ class WebInstaller_Options extends WebInstallerPage {
                        }
                }
 
+               $emailwrapperStyle = $this->getVar( 'wgEnableEmail' ) ? '' : 'display: none';
                $this->startForm();
                $this->addHTML(
                        # User Rights
@@ -730,7 +776,7 @@ class WebInstaller_Options extends WebInstallerPage {
                                'itemLabelPrefix' => 'config-profile-',
                                'values' => array_keys( $this->parent->rightsProfiles ),
                        ) ) .
-                       $this->parent->getHelpBox( 'config-profile-help' ) .
+                       $this->parent->getInfoBox( wfMsgNoTrans( 'config-profile-help' ) ) .
 
                        # Licensing
                        $this->parent->getRadioSet( array(
@@ -751,7 +797,7 @@ class WebInstaller_Options extends WebInstallerPage {
                                'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'emailwrapper' ),
                        ) ) .
                        $this->parent->getHelpBox( 'config-enable-email-help' ) .
-                       "<div id=\"emailwrapper\">" .
+                       "<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" .
                        $this->parent->getTextBox( array(
                                'var' => 'wgPasswordSender',
                                'label' => 'config-email-sender'
@@ -782,22 +828,31 @@ class WebInstaller_Options extends WebInstallerPage {
                );
 
                $extensions = $this->parent->findExtensions();
-               
+
                if( $extensions ) {
                        $extHtml = $this->getFieldSetStart( 'config-extensions' );
-                       
+
                        foreach( $extensions as $ext ) {
                                $extHtml .= $this->parent->getCheckBox( array(
                                        'var' => "ext-$ext",
                                        'rawtext' => $ext,
                                ) );
                        }
-                       
+
                        $extHtml .= $this->parent->getHelpBox( 'config-extensions-help' ) .
                        $this->getFieldSetEnd();
                        $this->addHTML( $extHtml );
                }
 
+               // Having / in paths in Windows looks funny :)
+               $this->setVar( 'wgDeletedDirectory',
+                       str_replace(
+                               '/', DIRECTORY_SEPARATOR,
+                               $this->getVar( 'wgDeletedDirectory' )
+                       )
+               );
+
+               $uploadwrapperStyle = $this->getVar( 'wgEnableUploads' ) ? '' : 'display: none';
                $this->addHTML(
                        # Uploading
                        $this->getFieldSetStart( 'config-upload-settings' ) .
@@ -805,26 +860,26 @@ class WebInstaller_Options extends WebInstallerPage {
                                'var' => 'wgEnableUploads',
                                'label' => 'config-upload-enable',
                                'attribs' => array( 'class' => 'showHideRadio', 'rel' => 'uploadwrapper' ),
-                           'help' => $this->parent->getHelpBox( 'config-upload-help' )
+                               'help' => $this->parent->getHelpBox( 'config-upload-help' )
                        ) ) .
-                       '<div id="uploadwrapper" style="display: none;">' .
+                       '<div id="uploadwrapper" style="' . $uploadwrapperStyle . '">' .
                        $this->parent->getTextBox( array(
                                'var' => 'wgDeletedDirectory',
                                'label' => 'config-upload-deleted',
-                           'help' => $this->parent->getHelpBox( 'config-upload-deleted-help' )
+                               'help' => $this->parent->getHelpBox( 'config-upload-deleted-help' )
                        ) ) .
                        '</div>' .
                        $this->parent->getTextBox( array(
                                'var' => 'wgLogo',
                                'label' => 'config-logo',
-                           'help' => $this->parent->getHelpBox( 'config-logo-help' )
+                               'help' => $this->parent->getHelpBox( 'config-logo-help' )
                        ) )
                );
                $this->addHTML(
                        $this->parent->getCheckBox( array(
                                'var' => 'wgUseInstantCommons',
                                'label' => 'config-instantcommons',
-                           'help' => $this->parent->getHelpBox( 'config-instantcommons-help' )
+                               'help' => $this->parent->getHelpBox( 'config-instantcommons-help' )
                        ) ) .
                        $this->getFieldSetEnd()
                );
@@ -848,7 +903,7 @@ class WebInstaller_Options extends WebInstallerPage {
                        ) ) .
                        $this->parent->getHelpBox( 'config-cache-help' ) .
                        '<div id="config-memcachewrapper">' .
-                       $this->parent->getTextBox( array(
+                       $this->parent->getTextArea( array(
                                'var' => '_MemCachedServers',
                                'label' => 'config-memcached-servers',
                                'help' => $this->parent->getHelpBox( 'config-memcached-help' )
@@ -895,9 +950,10 @@ class WebInstaller_Options extends WebInstallerPage {
                } else {
                        $iframeAttribs['src'] = $this->getCCPartnerUrl();
                }
+               $wrapperStyle = ($this->getVar('_LicenseCode') == 'cc-choose') ? '' : 'display: none';
 
                return
-                       "<div class=\"config-cc-wrapper\" id=\"config-cc-wrapper\" style=\"display: none;\">\n" .
+                       "<div class=\"config-cc-wrapper\" id=\"config-cc-wrapper\" style=\"$wrapperStyle\">\n" .
                        Html::element( 'iframe', $iframeAttribs, '', false /* not short */ ) .
                        "</div>\n";
        }
@@ -983,41 +1039,73 @@ class WebInstaller_Options extends WebInstallerPage {
                        }
                }
                $this->parent->setVar( '_Extensions', $extsToInstall );
+
+               if( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) {
+                       $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) );
+                       if( !$memcServers ) {
+                               $this->parent->showError( 'config-memcache-needservers' );
+                               return false;
+                       }
+
+                       foreach( $memcServers as $server ) {
+                               $memcParts = explode( ":", $server );
+                               if( !IP::isValid( $memcParts[0] ) ) {
+                                       $this->parent->showError( 'config-memcache-badip', $memcParts[0] );
+                                       return false;
+                               } elseif( !isset( $memcParts[1] )  ) {
+                                       $this->parent->showError( 'config-memcache-noport', $memcParts[0] );
+                                       return false;
+                               } elseif( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
+                                       $this->parent->showError( 'config-memcache-badport', 1, 65535 );
+                                       return false;
+                               }
+                       }
+               }
                return true;
        }
-       
+
 }
 
 class WebInstaller_Install extends WebInstallerPage {
 
        public function execute() {
-               if( $this->parent->request->wasPosted() ) {
-                       return 'continue';
-               } elseif( $this->getVar( '_InstallDone' ) ) {
-                       $this->startForm();
-                       $status = new Status();
-                       $status->warning( 'config-install-alreadydone' );
-                       $this->parent->showStatusBox( $status );
-               } elseif( $this->getVar( '_UpgradeDone' ) ) {
+               if( $this->getVar( '_UpgradeDone' ) ) {
                        return 'skip';
-               } else {
+               } elseif( $this->getVar( '_InstallDone' ) ) {
+                       return 'continue';
+               } elseif( $this->parent->request->wasPosted() ) {
                        $this->startForm();
                        $this->addHTML("<ul>");
-                       $this->parent->performInstallation(
+                       $results = $this->parent->performInstallation(
                                array( $this, 'startStage'),
                                array( $this, 'endStage' )
                        );
                        $this->addHTML("</ul>");
+                       // PerformInstallation bails on a fatal, so make sure the last item
+                       // completed before giving 'next.' Likewise, only provide back on failure
+                       $lastStep = end( $results );
+                       $continue = $lastStep->isOK() ? 'continue' : false;
+                       $back = $lastStep->isOK() ? false : 'back';
+                       $this->endForm( $continue, $back );
+               } else {
+                       $this->startForm();
+                       $this->addHTML( $this->parent->getInfoBox( wfMsgNoTrans( 'config-install-begin' ) ) );
+                       $this->endForm();
                }
-               $this->endForm();
                return true;
        }
 
        public function startStage( $step ) {
                $this->addHTML( "<li>" . wfMsgHtml( "config-install-$step" ) . wfMsg( 'ellipsis') );
+               if ( $step == 'extension-tables' ) {
+                       $this->startLiveBox();
+               }
        }
 
        public function endStage( $step, $status ) {
+               if ( $step == 'extension-tables' ) {
+                       $this->endLiveBox();
+               }
                $msg = $status->isOk() ? 'config-install-step-done' : 'config-install-step-failed';
                $html = wfMsgHtml( 'word-separator' ) . wfMsgHtml( $msg );
                if ( !$status->isOk() ) {
@@ -1028,16 +1116,22 @@ class WebInstaller_Install extends WebInstallerPage {
                        $this->parent->showStatusBox( $status );
                }
        }
-       
+
 }
 
 class WebInstaller_Complete extends WebInstallerPage {
-       
+
        public function execute() {
-               // Pop up a dialog box, to make it difficult for the user to forget 
+               // Pop up a dialog box, to make it difficult for the user to forget
                // to download the file
                $lsUrl = $GLOBALS['wgServer'] . $this->parent->getURL( array( 'localsettings' => 1 ) );
-               $this->parent->request->response()->header( "Refresh: 0;$lsUrl" );
+               if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) {
+                       // JS appears the only method that works consistently with IE7+
+                       $this->addHtml( "\n<script type=\"" . $GLOBALS['wgJsMimeType'] . '">jQuery( document ).ready( function() { document.location='
+                               . Xml::encodeJsVar( $lsUrl) . "; } );</script>\n" );
+               } else {
+                       $this->parent->request->response()->header( "Refresh: 0;url=$lsUrl" );
+               }
 
                $this->startForm();
                $this->parent->disableLinkPopups();
@@ -1058,15 +1152,13 @@ class WebInstaller_Complete extends WebInstallerPage {
 }
 
 class WebInstaller_Restart extends WebInstallerPage {
-       
+
        public function execute() {
                $r = $this->parent->request;
                if ( $r->wasPosted() ) {
                        $really = $r->getVal( 'submit-restart' );
                        if ( $really ) {
-                               $this->parent->session = array();
-                               $this->parent->happyPages = array();
-                               $this->parent->settings = array();
+                               $this->parent->reset();
                        }
                        return 'continue';
                }
@@ -1076,11 +1168,11 @@ class WebInstaller_Restart extends WebInstallerPage {
                $this->addHTML( $s );
                $this->endForm( 'restart' );
        }
-       
+
 }
 
 abstract class WebInstaller_Document extends WebInstallerPage {
-       
+
        protected abstract function getFileName();
 
        public  function execute() {
@@ -1123,7 +1215,7 @@ abstract class WebInstaller_Document extends WebInstallerPage {
                return '<span class="config-plainlink">[http://www.mediawiki.org/wiki/Manual:' .
                        $matches[1] . ' ' . $matches[1] . ']</span>';
        }
-       
+
 }
 
 class WebInstaller_Readme extends WebInstaller_Document {