Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -67,6 +67,7 @@ |
68 | 68 | } |
69 | 69 | $this->maintenance->setDB( $db ); |
70 | 70 | $this->initOldGlobals(); |
| 71 | + $this->initIncludedExtensions(); |
71 | 72 | wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) ); |
72 | 73 | } |
73 | 74 | |
— | — | @@ -89,6 +90,28 @@ |
90 | 91 | } |
91 | 92 | |
92 | 93 | /** |
| 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 | + /** |
93 | 116 | * @throws MWException |
94 | 117 | * @param DatabaseBase $db |
95 | 118 | * @param bool $shared |