From: Max Semenik Date: Sat, 4 Jun 2011 21:56:44 +0000 (+0000) Subject: Revert r89254: X-Git-Tag: 1.31.0-rc.0~29711 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=2bd63b50c52940cb7d58e98cd4f2c67e2878fe0b;p=lhc%2Fweb%2Fwiklou.git Revert r89254: * It breaks if any extension uses any global except $IP, $wgHooks or $wgAutoloadClasses. Some unit tests that try updating a virtual database are already affected. * If we have LocalSettings.php, we already have it loaded - are there code paths that don't have it? * Parsing PHP with regexes is fragile and scary --- diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 2d863dbc35..f66f81c057 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -73,7 +73,6 @@ abstract class DatabaseUpdater { } $this->maintenance->setDB( $db ); $this->initOldGlobals(); - $this->initIncludedExtensions(); wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) ); } @@ -95,28 +94,6 @@ abstract class DatabaseUpdater { $wgExtModifiedFields = array(); // table, index, dir } - /** - * Try to include extensions from LocalSettings so their LocalExtensionSchemaChanges hooks can be run - */ - private function initIncludedExtensions() { - global $IP, $wgHooks, $wgAutoloadClasses; - $ls = file_get_contents( "$IP/LocalSettings.php" ); - if ( $ls === false ) return; - $matches = array(); - preg_match_all( '/[[:blank:]]*(?:require|include){1}(?:_once)?[[:blank:]]*\([[:blank:]]*"\$IP\/extensions\/([^\/].*)\/\1\.php"[[:blank:]]*\);[[:blank:]]*/i', - $ls, $matches, PREG_SET_ORDER ); - unset( $ls ); - - if ( !isset( $wgHooks ) ) - $wgHooks = array(); - if ( !isset( $wgAutoloadClasses ) ) - $wgAutoloadClasses = array(); - - foreach ( $matches as $match ) { - include_once ( "$IP/extensions/{$match[1]}/{$match[1]}.php" ); - } - } - /** * @throws MWException * @param DatabaseBase $db