r74141 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74140‎ | r74141 | r74142 >
Date:13:51, 2 October 2010
Author:ialex
Status:ok
Tags:
Comment:
Converted CategoryIntersection extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/CategoryIntersection/CategoryIntersection.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryIntersection/CategoryIntersection.php
@@ -95,12 +95,18 @@
9696 # new tables needed (based on how ReaderFeedback extension does it)
9797 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCategoryIntersectionSchemaUpdates';
9898
99 -function efCategoryIntersectionSchemaUpdates() {
100 - global $wgDBtype, $wgExtNewTables;
101 - $base = dirname( __FILE__ );
102 - if ( $wgDBtype == 'mysql' ) {
103 - $wgExtNewTables[] = array( 'categoryintersections', "$base/CategoryIntersection.sql" );
104 - }
105 - return true;
 99+function efCategoryIntersectionSchemaUpdates( $updater = null ) {
 100+ $base = dirname( __FILE__ );
 101+ if ( $updater === null ) {
 102+ global $wgDBtype, $wgExtNewTables;
 103+ if ( $wgDBtype == 'mysql' ) {
 104+ $wgExtNewTables[] = array( 'categoryintersections', "$base/CategoryIntersection.sql" );
 105+ }
 106+ } else {
 107+ if ( $updater->getDB()->getType() == 'mysql' ) {
 108+ $updater->addExtensionUpdate( array( 'addTable', 'categoryintersections', "$base/CategoryIntersection.sql", true ) );
 109+ }
 110+ }
 111+ return true;
106112 }
107113

Status & tagging log