r76831 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76830‎ | r76831 | r76832 >
Date:20:27, 16 November 2010
Author:ialex
Status:deferred
Tags:
Comment:
Converted LiquidThreads extension to use the new version of the LoadExtensionSchemaUpdates hook
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/Hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/Hooks.php
@@ -298,36 +298,60 @@
299299 return true;
300300 }
301301
302 - public static function onLoadExtensionSchemaUpdates() {
303 - global $wgExtNewTables, $wgExtNewFields, $wgExtNewIndexes;
304 -
 302+ public static function onLoadExtensionSchemaUpdates( $updater = null ) {
305303 $dir = realpath( dirname( __FILE__ ) . '/..' );
306304
307 - // DB updates
308 - $wgExtNewTables[] = array( 'thread', "$dir/lqt.sql" );
309 - $wgExtNewTables[] = array( 'user_message_state', "$dir/lqt.sql" );
310 - $wgExtNewTables[] = array( 'thread_history', "$dir/schema-changes/thread_history_table.sql" );
311 - $wgExtNewTables[] = array( 'thread_pending_relationship', "$dir/schema-changes/thread_pending_relationship.sql" );
312 - $wgExtNewTables[] = array( 'thread_reaction', "$dir/schema-changes/thread_reactions.sql" );
 305+ if ( $updater === null ) {
 306+ // DB updates
 307+ $wgExtNewTables[] = array( 'thread', "$dir/lqt.sql" );
 308+ $wgExtNewTables[] = array( 'user_message_state', "$dir/lqt.sql" );
 309+ $wgExtNewTables[] = array( 'thread_history', "$dir/schema-changes/thread_history_table.sql" );
 310+ $wgExtNewTables[] = array( 'thread_pending_relationship', "$dir/schema-changes/thread_pending_relationship.sql" );
 311+ $wgExtNewTables[] = array( 'thread_reaction', "$dir/schema-changes/thread_reactions.sql" );
313312
314 - $wgExtNewFields[] = array( "thread", "thread_article_namespace", "$dir/schema-changes/split-thread_article.sql" );
315 - $wgExtNewFields[] = array( "thread", "thread_article_title", "$dir/schema-changes/split-thread_article.sql" );
316 - $wgExtNewFields[] = array( "thread", "thread_ancestor", "$dir/schema-changes/normalise-ancestry.sql" );
317 - $wgExtNewFields[] = array( "thread", "thread_parent", "$dir/schema-changes/normalise-ancestry.sql" );
318 - $wgExtNewFields[] = array( "thread", "thread_modified", "$dir/schema-changes/split-timestamps.sql" );
319 - $wgExtNewFields[] = array( "thread", "thread_created", "$dir/schema-changes/split-timestamps.sql" );
320 - $wgExtNewFields[] = array( "thread", "thread_editedness", "$dir/schema-changes/store-editedness.sql" );
321 - $wgExtNewFields[] = array( "thread", "thread_subject", "$dir/schema-changes/store_subject-author.sql" );
322 - $wgExtNewFields[] = array( "thread", "thread_author_id", "$dir/schema-changes/store_subject-author.sql" );
323 - $wgExtNewFields[] = array( "thread", "thread_author_name", "$dir/schema-changes/store_subject-author.sql" );
324 - $wgExtNewFields[] = array( "thread", "thread_sortkey", "$dir/schema-changes/new-sortkey.sql" );
325 - $wgExtNewFields[] = array( 'thread', 'thread_replies', "$dir/schema-changes/store_reply_count.sql" );
326 - $wgExtNewFields[] = array( 'thread', 'thread_article_id', "$dir/schema-changes/store_article_id.sql" );
327 - $wgExtNewFields[] = array( 'thread', 'thread_signature', "$dir/schema-changes/thread_signature.sql" );
328 - $wgExtNewFields[] = array( 'user_message_state', 'ums_conversation', "$dir/schema-changes/ums_conversation.sql" );
 313+ $wgExtNewFields[] = array( "thread", "thread_article_namespace", "$dir/schema-changes/split-thread_article.sql" );
 314+ $wgExtNewFields[] = array( "thread", "thread_article_title", "$dir/schema-changes/split-thread_article.sql" );
 315+ $wgExtNewFields[] = array( "thread", "thread_ancestor", "$dir/schema-changes/normalise-ancestry.sql" );
 316+ $wgExtNewFields[] = array( "thread", "thread_parent", "$dir/schema-changes/normalise-ancestry.sql" );
 317+ $wgExtNewFields[] = array( "thread", "thread_modified", "$dir/schema-changes/split-timestamps.sql" );
 318+ $wgExtNewFields[] = array( "thread", "thread_created", "$dir/schema-changes/split-timestamps.sql" );
 319+ $wgExtNewFields[] = array( "thread", "thread_editedness", "$dir/schema-changes/store-editedness.sql" );
 320+ $wgExtNewFields[] = array( "thread", "thread_subject", "$dir/schema-changes/store_subject-author.sql" );
 321+ $wgExtNewFields[] = array( "thread", "thread_author_id", "$dir/schema-changes/store_subject-author.sql" );
 322+ $wgExtNewFields[] = array( "thread", "thread_author_name", "$dir/schema-changes/store_subject-author.sql" );
 323+ $wgExtNewFields[] = array( "thread", "thread_sortkey", "$dir/schema-changes/new-sortkey.sql" );
 324+ $wgExtNewFields[] = array( 'thread', 'thread_replies', "$dir/schema-changes/store_reply_count.sql" );
 325+ $wgExtNewFields[] = array( 'thread', 'thread_article_id', "$dir/schema-changes/store_article_id.sql" );
 326+ $wgExtNewFields[] = array( 'thread', 'thread_signature', "$dir/schema-changes/thread_signature.sql" );
 327+ $wgExtNewFields[] = array( 'user_message_state', 'ums_conversation', "$dir/schema-changes/ums_conversation.sql" );
329328
330 - $wgExtNewIndexes[] = array( 'thread', 'thread_summary_page', '(thread_summary_page)' );
 329+ $wgExtNewIndexes[] = array( 'thread', 'thread_summary_page', '(thread_summary_page)' );
 330+ } else {
 331+ $updater->addExtensionUpdate( array( 'addTable', 'thread', "$dir/lqt.sql", true ) );
 332+ $updater->addExtensionUpdate( array( 'addTable', 'user_message_state', "$dir/lqt.sql", true ) );
 333+ $updater->addExtensionUpdate( array( 'addTable', 'thread_history', "$dir/schema-changes/thread_history_table.sql", true ) );
 334+ $updater->addExtensionUpdate( array( 'addTable', 'thread_pending_relationship', "$dir/schema-changes/thread_pending_relationship.sql", true ) );
 335+ $updater->addExtensionUpdate( array( 'addTable', 'thread_reaction', "$dir/schema-changes/thread_reactions.sql", true ) );
331336
 337+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_article_namespace", "$dir/schema-changes/split-thread_article.sql", true ) );
 338+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_article_title", "$dir/schema-changes/split-thread_article.sql", true ) );
 339+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_ancestor", "$dir/schema-changes/normalise-ancestry.sql", true ) );
 340+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_parent", "$dir/schema-changes/normalise-ancestry.sql", true ) );
 341+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_modified", "$dir/schema-changes/split-timestamps.sql", true ) );
 342+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_created", "$dir/schema-changes/split-timestamps.sql", true ) );
 343+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_editedness", "$dir/schema-changes/store-editedness.sql", true ) );
 344+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_subject", "$dir/schema-changes/store_subject-author.sql", true ) );
 345+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_author_id", "$dir/schema-changes/store_subject-author.sql", true ) );
 346+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_author_name", "$dir/schema-changes/store_subject-author.sql", true ) );
 347+ $updater->addExtensionUpdate( array( 'addField', "thread", "thread_sortkey", "$dir/schema-changes/new-sortkey.sql", true ) );
 348+ $updater->addExtensionUpdate( array( 'addField', 'thread', 'thread_replies', "$dir/schema-changes/store_reply_count.sql", true ) );
 349+ $updater->addExtensionUpdate( array( 'addField', 'thread', 'thread_article_id', "$dir/schema-changes/store_article_id.sql", true ) );
 350+ $updater->addExtensionUpdate( array( 'addField', 'thread', 'thread_signature', "$dir/schema-changes/thread_signature.sql", true ) );
 351+ $updater->addExtensionUpdate( array( 'addField', 'user_message_state', 'ums_conversation', "$dir/schema-changes/ums_conversation.sql", true ) );
 352+
 353+ $updater->addExtensionUpdate( array( 'addIndex', 'thread', 'thread_summary_page', '(thread_summary_page)' ) );
 354+ }
 355+
332356 return true;
333357 }
334358

Status & tagging log