r73938 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73937‎ | r73938 | r73939 >
Date:08:17, 29 September 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
More cleanup. Got rid of most references to page| prefix for translatable page message groups in preparation for a switch
Modified paths:
  • /trunk/extensions/Translate/tag/RenderJob.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/RenderJob.php
@@ -34,7 +34,7 @@
3535 function run() {
3636 // Initialization
3737 $title = $this->title;
38 - list( $key, $code ) = TranslateUtils::figureMessage( $title->getPrefixedText() );
 38+ list( , $code ) = TranslateUtils::figureMessage( $title->getPrefixedText() );
3939
4040 // Return the actual translation page...
4141 $page = TranslatablePage::isTranslationPage( $title );
@@ -44,7 +44,7 @@
4545 throw new MWException( "Oops, this should not happen!" );
4646 }
4747
48 - $group = MessageGroups::getGroup( "page|$key" );
 48+ $group = $page->getMessageGroup();
4949 $collection = $group->initCollection( $code );
5050
5151 $text = $page->getParse()->getTranslationPageText( $collection );
@@ -59,19 +59,10 @@
6060 // @todo Fuzzybot hack
6161 PageTranslationHooks::$allowTargetEdit = true;
6262
63 - // User hack
64 - global $wgUser;
65 -
66 - $oldUser = $wgUser;
67 - $wgUser = $user;
68 -
6963 // Do the edit
70 - $status = $article->doEdit( $text, $summary, $flags );
 64+ $status = $article->doEdit( $text, $summary, $flags, false, $user );
7165 SpecialPageTranslation::superDebug( __METHOD__, 'edit', $user, $title, $flags, $status );
7266
73 - // User hack
74 - $wgUser = $oldUser;
75 -
7667 PageTranslationHooks::$allowTargetEdit = false;
7768
7869 // purge cache
Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -131,7 +131,7 @@
132132 $titleText = $page->getTitle()->getPrefixedText();
133133 $num = $wgLang->formatNum( $page->getParse()->countSections() );
134134 $link = SpecialPage::getTitleFor( 'Translate' )->getFullUrl(
135 - array( 'group' => 'page|' . $page->getTitle()->getPrefixedText() ) );
 135+ array( 'group' => $page->getMessageGroupId() ) );
136136
137137 $wgOut->addWikiMsg( 'tpt-saveok', $titleText, $num, $link );
138138 }
@@ -301,7 +301,7 @@
302302 SpecialPage::getTitleFor( 'Translate' ),
303303 wfMsgHtml( 'tpt-translate-this' ),
304304 array(),
305 - array( 'group' => 'page|' . $title->getPrefixedText() )
 305+ array( 'group' => TranslatablePage::getMessageGroupIdFromTitle( $title )
306306 );
307307 }
308308
@@ -527,7 +527,7 @@
528528
529529 // Re-generate caches
530530 $page->getTranslationPercentages( /*re-generate*/ true );
531 - ArrayMemoryCache::factory( 'groupstats' )->clearGroup( 'page|' . $page->getTitle()->getPrefixedText() );
 531+ ArrayMemoryCache::factory( 'groupstats' )->clearGroup( $page->getMessageGroupId() );
532532 MessageIndexRebuilder::execute();
533533 return false;
534534 }

Status & tagging log