Merge "Title::getContentModel(): load from DB if necessary"
[lhc/web/wiklou.git] / includes / installer / Installer.php
index fa41974..57fdab3 100644 (file)
@@ -119,7 +119,6 @@ abstract class Installer {
                'envCheckRegisterGlobals',
                'envCheckBrokenXML',
                'envCheckMagicQuotes',
-               'envCheckMagicSybase',
                'envCheckMbstring',
                'envCheckSafeMode',
                'envCheckXML',
@@ -137,6 +136,7 @@ abstract class Installer {
                'envCheckLibicu',
                'envCheckSuhosinMaxValueLength',
                'envCheckCtype',
+               'envCheckIconv',
                'envCheckJSON',
        );
 
@@ -352,17 +352,10 @@ abstract class Installer {
        abstract public function showError( $msg /*, ... */ );
 
        /**
-        * Shows messages to the user through a Status object
+        * Show a message to the installing user by using a Status object
         * @param Status $status
         */
-       public function showStatusMessage( Status $status ) {
-               $errors = array_merge( $status->getErrorsArray(), $status->getWarningsArray() );
-               if ( $errors ) {
-                       foreach ( $errors as $error ) {
-                               call_user_func( 'showMessage', $error );
-                       }
-               }
-       }
+       abstract public function showStatusMessage( Status $status );
 
        /**
         * Constructor, always call this from child classes.
@@ -536,6 +529,14 @@ abstract class Installer {
        public static function getExistingLocalSettings() {
                global $IP;
 
+               // You might be wondering why this is here. Well if you don't do this
+               // then some poorly-formed extensions try to call their own classes
+               // after immediately registering them. We really need to get extension
+               // registration out of the global scope and into a real format.
+               // @see https://bugzilla.wikimedia.org/67440
+               global $wgAutoloadClasses;
+               $wgAutoloadClasses = array();
+
                wfSuppressWarnings();
                $_lsExists = file_exists( "$IP/LocalSettings.php" );
                wfRestoreWarnings();
@@ -761,31 +762,19 @@ abstract class Installer {
        }
 
        /**
-        * Environment check for magic_quotes_runtime.
+        * Environment check for magic_quotes_(gpc|runtime|sybase).
         * @return bool
         */
        protected function envCheckMagicQuotes() {
-               if ( wfIniGetBool( "magic_quotes_runtime" ) ) {
-                       $this->showError( 'config-magic-quotes-runtime' );
-
-                       return false;
-               }
-
-               return true;
-       }
-
-       /**
-        * Environment check for magic_quotes_sybase.
-        * @return bool
-        */
-       protected function envCheckMagicSybase() {
-               if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
-                       $this->showError( 'config-magic-quotes-sybase' );
-
-                       return false;
+               $status = true;
+               foreach ( array( 'gpc', 'runtime', 'sybase' ) as $magicJunk ) {
+                       if ( wfIniGetBool( "magic_quotes_$magicJunk" ) ) {
+                               $this->showError( "config-magic-quotes-$magicJunk" );
+                               $status = false;
+                       }
                }
 
-               return true;
+               return $status;
        }
 
        /**
@@ -1207,6 +1196,19 @@ abstract class Installer {
                return true;
        }
 
+       /**
+        * @return bool
+        */
+       protected function envCheckIconv() {
+               if ( !function_exists( 'iconv' ) ) {
+                       $this->showError( 'config-iconv' );
+
+                       return false;
+               }
+
+               return true;
+       }
+
        /**
         * @return bool
         */
@@ -1280,8 +1282,8 @@ abstract class Installer {
         *
         * Used only by environment checks.
         *
-        * @param string $path path to search
-        * @param array $names of executable names
+        * @param string $path Path to search
+        * @param array $names Array of executable names
         * @param array|bool $versionInfo False or array with two members:
         *   0 => Command to run for version check, with $1 for the full executable name
         *   1 => String to compare the output with