Merge "Installer: page refresh should refresh list of supported DBs"
authorMarkAHershberger <mhershberger@wikimedia.org>
Mon, 29 Jul 2013 22:30:37 +0000 (22:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 29 Jul 2013 22:30:37 +0000 (22:30 +0000)
1  2 
includes/installer/Installer.php
includes/installer/WebInstallerPage.php

@@@ -46,6 -46,14 +46,14 @@@ abstract class Installer 
         */
        protected $settings;
  
+       /**
+        * List of detected DBs, access using getCompiledDBs().
+        *
+        * @var array
+        */
+       protected $compiledDBs;
        /**
         * Cached DB installer instances, access using getDBInstaller().
         *
        protected $internalDefaults = array(
                '_UserLang' => 'en',
                '_Environment' => false,
-               '_CompiledDBs' => array(),
                '_SafeMode' => false,
                '_RaiseMemory' => false,
                '_UpgradeDone' => false,
                                }
                        }
                }
-               $this->setVar( '_CompiledDBs', $compiledDBs );
+               $this->compiledDBs = $compiledDBs;
  
                $this->parserTitle = Title::newFromText( 'Installer' );
                $this->parserOptions = new ParserOptions; // language will  be wrong :(
                }
        }
  
+       /**
+        * Get a list of DBs supported by current PHP setup
+        *
+        * @return array
+        */
+       public function getCompiledDBs() {
+               return $this->compiledDBs;
+       }
        /**
         * Get an instance of DatabaseInstaller for the specified DB type.
         *
                        $allNames[] = wfMessage( "config-type-$name" )->text();
                }
  
-               // cache initially available databases to make sure that everything will be displayed correctly
-               // after a refresh on env checks page
-               $databases = $this->getVar( '_CompiledDBs-preFilter' );
-               if ( !$databases ) {
-                       $databases = $this->getVar( '_CompiledDBs' );
-                       $this->setVar( '_CompiledDBs-preFilter', $databases );
-               }
+               $databases = $this->getCompiledDBs();
  
                $databases = array_flip ( $databases );
                foreach ( array_keys( $databases ) as $db ) {
                        // @todo FIXME: This only works for the web installer!
                        return false;
                }
-               $this->setVar( '_CompiledDBs', $databases );
                return true;
        }
  
        }
  
        /**
 -       * Checks if suhosin.get.max_value_length is set, and if so, sets
 -       * $wgResourceLoaderMaxQueryLength to that value in the generated
 -       * LocalSettings file
 +       * Checks if suhosin.get.max_value_length is set, and if so generate
 +       * a warning because it decreases ResourceLoader performance.
         * @return bool
         */
        protected function envCheckSuhosinMaxValueLength() {
                $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
 -              if ( $maxValueLength > 0 ) {
 -                      if ( $maxValueLength < 1024 ) {
 -                              # Only warn if the value is below the sane 1024
 -                              $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
 -                      }
 -              } else {
 -                      $maxValueLength = -1;
 +              if ( $maxValueLength > 0 &&  $maxValueLength < 1024 ) {
 +                      // Only warn if the value is below the sane 1024
 +                      $this->showMessage( 'config-suhosin-max-value-length', $maxValueLength );
                }
 -              $this->setVar( 'wgResourceLoaderMaxQueryLength', $maxValueLength );
                return true;
        }
  
@@@ -469,7 -469,7 +469,7 @@@ class WebInstaller_DBConnect extends We
  
                // It's possible that the library for the default DB type is not compiled in.
                // In that case, instead select the first supported DB type in the list.
-               $compiledDBs = $this->parent->getVar( '_CompiledDBs' );
+               $compiledDBs = $this->parent->getCompiledDBs();
                if ( !in_array( $defaultType, $compiledDBs ) ) {
                        $defaultType = $compiledDBs[0];
                }
@@@ -1254,8 -1254,8 +1254,8 @@@ class WebInstaller_Complete extends Web
                $lsUrl = $this->getVar( 'wgServer' ) . $this->parent->getURL( array( 'localsettings' => 1 ) );
                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>jQuery( document ).ready( function () { document.location = " .
 +                      // JS appears to be the only method that works consistently with IE7+
 +                      $this->addHtml( "\n<script>jQuery( function () { document.location = " .
                                Xml::encodeJsVar( $lsUrl ) . "; } );</script>\n" );
                } else {
                        $this->parent->request->response()->header( "Refresh: 0;url=$lsUrl" );