Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changes
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 5ae499d..72e11db 100644 (file)
@@ -146,7 +146,6 @@ abstract class Installer {
         * @var array
         */
        protected $envPreps = array(
-               'envPrepExtension',
                'envPrepServer',
                'envPrepPath',
        );
@@ -177,7 +176,6 @@ abstract class Installer {
                'wgGitBin',
                'IP',
                'wgScriptPath',
-               'wgScriptExtension',
                'wgMetaNamespace',
                'wgDeletedDirectory',
                'wgEnableUploads',
@@ -536,13 +534,17 @@ abstract class Installer {
                // 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
+               // @see https://phabricator.wikimedia.org/T69440
                global $wgAutoloadClasses;
                $wgAutoloadClasses = array();
 
-               wfSuppressWarnings();
+               // LocalSettings.php should not call functions, except wfLoadSkin/wfLoadExtensions
+               // Define the required globals here, to ensure, the functions can do it work correctly.
+               global $wgExtensionDirectory, $wgStyleDirectory;
+
+               MediaWiki\suppressWarnings();
                $_lsExists = file_exists( "$IP/LocalSettings.php" );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$_lsExists ) {
                        return false;
@@ -830,14 +832,14 @@ abstract class Installer {
         * @return bool
         */
        protected function envCheckPCRE() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
                // Need to check for \p support too, as PCRE can be compiled
                // with utf8 support, but not unicode property support.
                // check that \p{Zs} (space separators) matches
                // U+3000 (Ideographic space)
                $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $regexd != '--' || $regexprop != '--' ) {
                        $this->showError( 'config-pcre-no-utf8' );
 
@@ -1125,12 +1127,12 @@ abstract class Installer {
                } elseif ( $c <= 0x7FF ) {
                        return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
                } elseif ( $c <= 0xFFFF ) {
-                       return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F )
-                       . chr( 0x80 | $c & 0x3F );
+                       return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F ) .
+                               chr( 0x80 | $c & 0x3F );
                } elseif ( $c <= 0x10FFFF ) {
-                       return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F )
-                       . chr( 0x80 | $c >> 6 & 0x3F )
-                       . chr( 0x80 | $c & 0x3F );
+                       return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F ) .
+                               chr( 0x80 | $c >> 6 & 0x3F ) .
+                               chr( 0x80 | $c & 0x3F );
                } else {
                        return false;
                }
@@ -1227,19 +1229,6 @@ abstract class Installer {
         */
        abstract protected function envGetDefaultServer();
 
-       /**
-        * Environment prep for setting the preferred PHP file extension.
-        */
-       protected function envPrepExtension() {
-               // @todo FIXME: Detect this properly
-               if ( defined( 'MW_INSTALL_PHP5_EXT' ) ) {
-                       $ext = '.php5';
-               } else {
-                       $ext = '.php';
-               }
-               $this->setVar( 'wgScriptExtension', $ext );
-       }
-
        /**
         * Environment prep for setting $IP and $wgScriptPath.
         */
@@ -1289,9 +1278,9 @@ abstract class Installer {
                foreach ( $names as $name ) {
                        $command = $path . DIRECTORY_SEPARATOR . $name;
 
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $file_exists = file_exists( $command );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( $file_exists ) {
                                if ( !$versionInfo ) {
@@ -1349,7 +1338,7 @@ abstract class Installer {
 
                // it would be good to check other popular languages here, but it'll be slow.
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
 
                foreach ( $scriptTypes as $ext => $contents ) {
                        foreach ( $contents as $source ) {
@@ -1368,14 +1357,14 @@ abstract class Installer {
                                unlink( $dir . $file );
 
                                if ( $text == 'exec' ) {
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
 
                                        return $ext;
                                }
                        }
                }
 
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return false;
        }
@@ -1488,7 +1477,7 @@ abstract class Installer {
                 * want here is $wgHooks['LoadExtensionSchemaUpdates']. This won't work
                 * if the extension has hidden hook registration in $wgExtensionFunctions,
                 * but we're not opening that can of worms
-                * @see https://bugzilla.wikimedia.org/show_bug.cgi?id=26857
+                * @see https://phabricator.wikimedia.org/T28857
                 */
                global $wgAutoloadClasses;
                $wgAutoloadClasses = array();
@@ -1809,8 +1798,8 @@ abstract class Installer {
         * Some long-running pages (Install, Upgrade) will want to do this
         */
        protected function disableTimeLimit() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                set_time_limit( 0 );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
        }
 }