r89254 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89253‎ | r89254 | r89255 >
Date:13:43, 1 June 2011
Author:freakolowsky
Status:reverted
Tags:
Comment:
* trying to create a way to update/install extension already included in the LocalSettings.php
* wgHooks and wgAutoloadClasses are initialized so they can be appended within extension inits
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/DatabaseUpdater.php
@@ -67,6 +67,7 @@
6868 }
6969 $this->maintenance->setDB( $db );
7070 $this->initOldGlobals();
 71+ $this->initIncludedExtensions();
7172 wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
7273 }
7374
@@ -89,6 +90,28 @@
9091 }
9192
9293 /**
 94+ * Try to include extensions from LocalSettings so their LocalExtensionSchemaChanges hooks can be run
 95+ */
 96+ private function initIncludedExtensions() {
 97+ global $IP, $wgHooks, $wgAutoloadClasses;
 98+ $ls = file_get_contents( "$IP/LocalSettings.php" );
 99+ if ( $ls === false ) return;
 100+ $matches = array();
 101+ preg_match_all( '/[[:blank:]]*(?:require|include){1}(?:_once)?[[:blank:]]*\([[:blank:]]*"\$IP\/extensions\/([^\/].*)\/\1\.php"[[:blank:]]*\);[[:blank:]]*/i',
 102+ $ls, $matches, PREG_SET_ORDER );
 103+ unset( $ls );
 104+
 105+ if ( !isset( $wgHooks ) )
 106+ $wgHooks = array();
 107+ if ( !isset( $wgAutoloadClasses ) )
 108+ $wgAutoloadClasses = array();
 109+
 110+ foreach ( $matches as $match ) {
 111+ include_once ( "$IP/extensions/{$match[1]}/{$match[1]}.php" );
 112+ }
 113+ }
 114+
 115+ /**
93116 * @throws MWException
94117 * @param DatabaseBase $db
95118 * @param bool $shared

Follow-up revisions

RevisionCommit summaryAuthorDate
r89481Revert r89254:...maxsem21:56, 4 June 2011
r89529Follow-up r89254 and r89481: re-did loading extension updates properly, now u...maxsem19:52, 5 June 2011

Status & tagging log