Index: trunk/extensions/GlobalUsage/GlobalUsageHooks.php |
— | — | @@ -118,15 +118,29 @@ |
119 | 119 | /** |
120 | 120 | * Hook to apply schema changes |
121 | 121 | */ |
122 | | - public static function onLoadExtensionSchemaUpdates() { |
123 | | - global $wgExtNewTables, $wgExtNewIndexes, $wgDBtype; |
| 122 | + public static function onLoadExtensionSchemaUpdates( $updater = null ) { |
124 | 123 | $dir = dirname( __FILE__ ); |
125 | | - if ( $wgDBtype == 'mysql' || $wgDBtype == 'sqlite' ) { |
126 | | - $wgExtNewTables[] = array( 'globalimagelinks', "$dir/GlobalUsage.sql" ); |
127 | | - $wgExtNewIndexes[] = array( 'globalimagelinks', 'globalimagelinks_wiki_nsid_title', "$dir/patches/patch-globalimagelinks_wiki_nsid_title.sql" ); |
128 | | - } else if ( $wgDBtype == 'postgresql' ) { |
129 | | - $wgExtNewTables[] = array( 'globalimagelinks', "$dir/GlobalUsage.pg.sql" ); |
130 | | - $wgExtNewIndexes[] = array( 'globalimagelinks', 'globalimagelinks_wiki_nsid_title', "$dir/patches/patch-globalimagelinks_wiki_nsid_title.pg.sql" ); |
| 124 | + if ( $updater === null ) { |
| 125 | + global $wgExtNewTables, $wgExtNewIndexes, $wgDBtype; |
| 126 | + if ( $wgDBtype == 'mysql' || $wgDBtype == 'sqlite' ) { |
| 127 | + $wgExtNewTables[] = array( 'globalimagelinks', "$dir/GlobalUsage.sql" ); |
| 128 | + $wgExtNewIndexes[] = array( 'globalimagelinks', 'globalimagelinks_wiki_nsid_title', "$dir/patches/patch-globalimagelinks_wiki_nsid_title.sql" ); |
| 129 | + } else if ( $wgDBtype == 'postgresql' ) { |
| 130 | + $wgExtNewTables[] = array( 'globalimagelinks', "$dir/GlobalUsage.pg.sql" ); |
| 131 | + $wgExtNewIndexes[] = array( 'globalimagelinks', 'globalimagelinks_wiki_nsid_title', "$dir/patches/patch-globalimagelinks_wiki_nsid_title.pg.sql" ); |
| 132 | + } |
| 133 | + } else { |
| 134 | + if ( $updater->getDB()->getType() == 'mysql' || $updater->getDB()->getType() == 'sqlite' ) { |
| 135 | + $updater->addExtensionUpdate( array( 'addTable', 'globalimagelinks', |
| 136 | + "$dir/GlobalUsage.sql", true ) ); |
| 137 | + $updater->addExtensionUpdate( array( 'addIndex', 'globalimagelinks', |
| 138 | + 'globalimagelinks_wiki_nsid_title', "$dir/patches/patch-globalimagelinks_wiki_nsid_title.sql", true ) ); |
| 139 | + } else if ( $updater->getDB()->getType() == 'postgresql' ) { |
| 140 | + $updater->addExtensionUpdate( array( 'addTable', 'globalimagelinks', |
| 141 | + "$dir/GlobalUsage.pg.sql", true ) ); |
| 142 | + $updater->addExtensionUpdate( array( 'addIndex', 'globalimagelinks', |
| 143 | + 'globalimagelinks_wiki_nsid_title', "$dir/patches/patch-globalimagelinks_wiki_nsid_title.pg.sql", true ) ); |
| 144 | + } |
131 | 145 | } |
132 | 146 | return true; |
133 | 147 | } |