Fix bug link for PhpRefCallBugTester class
[lhc/web/wiklou.git] / includes / installer / WebInstallerPage.php
index 3ea97d0..d35046d 100644 (file)
@@ -103,6 +103,8 @@ abstract class WebInstallerPage {
         * Get the starting tags of a fieldset.
         *
         * @param $legend String: message name
+        *
+        * @return string
         */
        protected function getFieldsetStart( $legend ) {
                return "\n<fieldset><legend>" . wfMsgHtml( $legend ) . "</legend>\n";
@@ -110,10 +112,33 @@ abstract class WebInstallerPage {
 
        /**
         * Get the end tag of a fieldset.
+        *
+        * @returns string
         */
        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 {
@@ -177,6 +202,8 @@ class WebInstaller_Language extends WebInstallerPage {
 
        /**
         * Get a <select> for selecting languages.
+        *
+        * @return string
         */
        public function getLanguageSelector( $name, $label, $selectedCode ) {
                global $wgDummyLanguageCodes;
@@ -223,7 +250,9 @@ class WebInstaller_ExistingWiki extends WebInstallerPage {
                // If there is no $wgUpgradeKey, tell the user to add one to LocalSettings.php
                if ( $vars['wgUpgradeKey'] === false ) {
                        if ( $this->getVar( 'wgUpgradeKey', false ) === false ) {
-                               $this->parent->generateUpgradeKey();
+                               $secretKey = $this->getVar( 'wgSecretKey' ); // preserve $wgSecretKey
+                               $this->parent->generateKeys();
+                               $this->setVar( 'wgSecretKey', $secretKey );
                                $this->setVar( '_UpgradeKeySupplied', true );
                        }
                        $this->startForm();
@@ -464,17 +493,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';
@@ -929,9 +958,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";
        }
@@ -1075,9 +1105,15 @@ class WebInstaller_Install extends WebInstallerPage {
 
        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() ) {