Index: trunk/extensions/Translate/MessageCollection.php |
— | — | @@ -188,11 +188,13 @@ |
189 | 189 | |
190 | 190 | /** |
191 | 191 | * 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. |
193 | 195 | */ |
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 ); |
197 | 199 | $this->initMessages(); |
198 | 200 | } |
199 | 201 | |
— | — | @@ -476,8 +478,9 @@ |
477 | 479 | /** |
478 | 480 | * Loads existence and fuzzy state for given list of keys. |
479 | 481 | * @param $keys \list{String} List of keys in database format. |
| 482 | + * @param $dbtype One of DB_* constants. |
480 | 483 | */ |
481 | | - protected function loadInfo( array $keys ) { |
| 484 | + protected function loadInfo( array $keys, $dbtype = DB_SLAVE ) { |
482 | 485 | if ( $this->dbInfo !== null ) { |
483 | 486 | return; |
484 | 487 | } |
— | — | @@ -488,7 +491,7 @@ |
489 | 492 | return; |
490 | 493 | } |
491 | 494 | |
492 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 495 | + $dbr = wfGetDB( $dbtype ); |
493 | 496 | |
494 | 497 | $tables = array( 'page', 'revtag' ); |
495 | 498 | $fields = array( 'page_title', 'rt_type' ); |
— | — | @@ -509,8 +512,9 @@ |
510 | 513 | /** |
511 | 514 | * Loads translation for given list of keys. |
512 | 515 | * @param $keys \list{String} List of keys in database format. |
| 516 | + * @param $dbtype One of DB_* constants. |
513 | 517 | */ |
514 | | - protected function loadData( $keys ) { |
| 518 | + protected function loadData( $keys, $dbtype = DB_SLAVE ) { |
515 | 519 | if ( $this->dbData !== null ) { |
516 | 520 | return; |
517 | 521 | } |
— | — | @@ -521,7 +525,7 @@ |
522 | 526 | return; |
523 | 527 | } |
524 | 528 | |
525 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 529 | + $dbr = wfGetDB( $dbtype ); |
526 | 530 | |
527 | 531 | $tables = array( 'page', 'revision', 'text' ); |
528 | 532 | $fields = array( 'page_title', 'rev_user_text', 'old_flags', 'old_text' ); |
Index: trunk/extensions/Translate/tag/RenderJob.php |
— | — | @@ -51,6 +51,7 @@ |
52 | 52 | |
53 | 53 | $group = $page->getMessageGroup(); |
54 | 54 | $collection = $group->initCollection( $code ); |
| 55 | + $collection->loadTranslations( DB_MASTER ); |
55 | 56 | |
56 | 57 | $text = $page->getParse()->getTranslationPageText( $collection ); |
57 | 58 | |
Index: trunk/extensions/Translate/tag/TPParse.php |
— | — | @@ -177,7 +177,7 @@ |
178 | 178 | // For finding the messages |
179 | 179 | $prefix = $this->title->getPrefixedDBKey() . '/'; |
180 | 180 | |
181 | | - if ( $collection instanceOf MessageCollection ) { |
| 181 | + if ( $collection instanceof MessageCollection ) { |
182 | 182 | $collection->filter( 'hastranslation', false ); |
183 | 183 | $collection->loadTranslations(); |
184 | 184 | } |