r99673 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r99672‎ | r99673 | r99674 >
Date:08:38, 13 October 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Possible fix for bug 31653
Modified paths:
  • /trunk/extensions/Translate/MessageCollection.php (modified) (history)
  • /trunk/extensions/Translate/tag/RenderJob.php (modified) (history)
  • /trunk/extensions/Translate/tag/TPParse.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/MessageCollection.php
@@ -188,11 +188,13 @@
189189
190190 /**
191191 * Loads all message data. Must be called before accessing the messages
192 - * with ArrayAccess or iteration.
 192+ * with ArrayAccess or iteration. Must be called before filtering for
 193+ * $dbtype to have an effect.
 194+ * @param $dbtype One of DB_* constants.
193195 */
194 - public function loadTranslations() {
195 - $this->loadData( $this->keys );
196 - $this->loadInfo( $this->keys );
 196+ public function loadTranslations( $dbtype = DB_SLAVE ) {
 197+ $this->loadData( $this->keys, $dbtype );
 198+ $this->loadInfo( $this->keys, $dbtype );
197199 $this->initMessages();
198200 }
199201
@@ -476,8 +478,9 @@
477479 /**
478480 * Loads existence and fuzzy state for given list of keys.
479481 * @param $keys \list{String} List of keys in database format.
 482+ * @param $dbtype One of DB_* constants.
480483 */
481 - protected function loadInfo( array $keys ) {
 484+ protected function loadInfo( array $keys, $dbtype = DB_SLAVE ) {
482485 if ( $this->dbInfo !== null ) {
483486 return;
484487 }
@@ -488,7 +491,7 @@
489492 return;
490493 }
491494
492 - $dbr = wfGetDB( DB_SLAVE );
 495+ $dbr = wfGetDB( $dbtype );
493496
494497 $tables = array( 'page', 'revtag' );
495498 $fields = array( 'page_title', 'rt_type' );
@@ -509,8 +512,9 @@
510513 /**
511514 * Loads translation for given list of keys.
512515 * @param $keys \list{String} List of keys in database format.
 516+ * @param $dbtype One of DB_* constants.
513517 */
514 - protected function loadData( $keys ) {
 518+ protected function loadData( $keys, $dbtype = DB_SLAVE ) {
515519 if ( $this->dbData !== null ) {
516520 return;
517521 }
@@ -521,7 +525,7 @@
522526 return;
523527 }
524528
525 - $dbr = wfGetDB( DB_SLAVE );
 529+ $dbr = wfGetDB( $dbtype );
526530
527531 $tables = array( 'page', 'revision', 'text' );
528532 $fields = array( 'page_title', 'rev_user_text', 'old_flags', 'old_text' );
Index: trunk/extensions/Translate/tag/RenderJob.php
@@ -51,6 +51,7 @@
5252
5353 $group = $page->getMessageGroup();
5454 $collection = $group->initCollection( $code );
 55+ $collection->loadTranslations( DB_MASTER );
5556
5657 $text = $page->getParse()->getTranslationPageText( $collection );
5758
Index: trunk/extensions/Translate/tag/TPParse.php
@@ -177,7 +177,7 @@
178178 // For finding the messages
179179 $prefix = $this->title->getPrefixedDBKey() . '/';
180180
181 - if ( $collection instanceOf MessageCollection ) {
 181+ if ( $collection instanceof MessageCollection ) {
182182 $collection->filter( 'hastranslation', false );
183183 $collection->loadTranslations();
184184 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r100004MFT r99673: possible fix for bug 31653: Translation page updates might not ha...siebrand23:12, 16 October 2011

Status & tagging log