r97174 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97173‎ | r97174 | r97175 >
Date:16:23, 15 September 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Move schema updates hook from PageTranslation to general hooks.
The extension needs most of these tables to function, only one table is page translation specific and it doesn't hurt to create it even if not used.
Modified paths:
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateHooks.php (modified) (history)
  • /trunk/extensions/Translate/tag/PageTranslationHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/PageTranslationHooks.php
@@ -385,16 +385,6 @@
386386 return true;
387387 }
388388
389 - public static function schemaUpdates( $updater ) {
390 - $dir = dirname( __FILE__ ) . '/../sql';
391 -
392 - $updater->addExtensionUpdate( array( 'addTable', 'translate_sections', "$dir/translate_sections.sql", true ) );
393 - $updater->addExtensionUpdate( array( 'addField', 'translate_sections', 'trs_order', "$dir/translate_sections-trs_order.patch.sql", true ) );
394 - $updater->addExtensionUpdate( array( 'addTable', 'revtag', "$dir/revtag.sql", true ) );
395 - $updater->addExtensionUpdate( array( 'addTable', 'translate_groupstats', "$dir/translate_groupstats.sql", true ) );
396 - return true;
397 - }
398 -
399389 /// @todo: fix method name.
400390 public static function test( &$article, &$outputDone, &$pcache ) {
401391 if ( !$article->getOldID() ) {
Index: trunk/extensions/Translate/Translate.php
@@ -52,6 +52,7 @@
5353 $wgExtensionFunctions[] = 'TranslateHooks::setupTranslate';
5454 $wgHooks['CanonicalNamespaces'][] = 'TranslateHooks::setupNamespaces';
5555 $wgHooks['UnitTestsList'][] = 'TranslateHooks::setupUnitTests';
 56+$wgHooks['LoadExtensionSchemaUpdates'][] = 'TranslateHooks::schemaUpdates';
5657
5758 // Register special pages into MediaWiki
5859 $wgSpecialPages['Translate'] = 'SpecialTranslate';
@@ -92,8 +93,6 @@
9394 $wgHooks['SkinTemplateTabs'][] = 'TranslateEditAddons::tabs';
9495 $wgHooks['LanguageGetTranslatedLanguageNames'][] = 'TranslateEditAddons::translateMessageDocumentationLanguage';
9596 $wgHooks['ArticlePrepareTextForEdit'][] = 'TranslateEditAddons::disablePreSaveTransform';
96 -// Hook for database schema.
97 -$wgHooks['LoadExtensionSchemaUpdates'][] = 'PageTranslationHooks::schemaUpdates';
9897 // Fuzzy tags for speed.
9998 $wgHooks['ArticleSaveComplete'][] = 'TranslateEditAddons::onSave';
10099 $wgHooks['Translate:newTranslation'][] = 'TranslateEditAddons::updateTransverTag';
Index: trunk/extensions/Translate/TranslateHooks.php
@@ -160,4 +160,15 @@
161161 return true;
162162 }
163163
 164+ /// Hook: LoadExtensionSchemaUpdates
 165+ public static function schemaUpdates( $updater ) {
 166+ $dir = dirname( __FILE__ ) . '/sql';
 167+
 168+ $updater->addExtensionUpdate( array( 'addTable', 'translate_sections', "$dir/translate_sections.sql", true ) );
 169+ $updater->addExtensionUpdate( array( 'addField', 'translate_sections', 'trs_order', "$dir/translate_sections-trs_order.patch.sql", true ) );
 170+ $updater->addExtensionUpdate( array( 'addTable', 'revtag', "$dir/revtag.sql", true ) );
 171+ $updater->addExtensionUpdate( array( 'addTable', 'translate_groupstats', "$dir/translate_groupstats.sql", true ) );
 172+ return true;
 173+ }
 174+
164175 }

Status & tagging log