Index: trunk/extensions/Translate/tag/TranslatablePage.php |
— | — | @@ -262,12 +262,12 @@ |
263 | 263 | return $db->select( 'revtag', $fields, $conds, __METHOD__, $options ); |
264 | 264 | } |
265 | 265 | |
266 | | - public function getTranslationPercentages() { |
| 266 | + public function getTranslationPercentages( $force = false ) { |
267 | 267 | // Check the memory cache, as this is very slow to calculate |
268 | 268 | global $wgMemc; |
269 | 269 | $memcKey = wfMemcKey( 'pt', 'status', $this->getTitle()->getPrefixedText() ); |
270 | 270 | $cache = $wgMemc->get( $memcKey ); |
271 | | - if ( is_array( $cache ) ) return $cache; |
| 271 | + if ( !$force && is_array( $cache ) ) return $cache; |
272 | 272 | |
273 | 273 | // Fetch the available translation pages from database |
274 | 274 | $dbr = wfGetDB( DB_SLAVE ); |
— | — | @@ -303,7 +303,6 @@ |
304 | 304 | // English is always up-to-date |
305 | 305 | $temp['en'] = 1.00; |
306 | 306 | |
307 | | - // TODO: Ideally there would be some kind of purging here |
308 | 307 | $wgMemc->set( $memcKey, $temp, 60*60*12 ); |
309 | 308 | return $temp; |
310 | 309 | } |
— | — | @@ -376,10 +375,11 @@ |
377 | 376 | |
378 | 377 | public static function isTranslationPage( Title $title ) { |
379 | 378 | if ( $title->getText() === $title->getBaseText() ) return false; |
380 | | - |
381 | | - $page = TranslatablePage::newFromTitle( |
382 | | - self::changeTitleText( $title, $title->getBaseText() ) ); |
383 | 379 | |
| 380 | + $newtitle = self::changeTitleText( $title, $title->getBaseText() ); |
| 381 | + if ( !$newtitle ) throw new MWException( $title->getPrefixedText() ); |
| 382 | + $page = TranslatablePage::newFromTitle( $newtitle ); |
| 383 | + |
384 | 384 | if ( $page->getMarkedTag() === false ) return false; |
385 | 385 | return $page; |
386 | 386 | } |
Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -327,7 +327,10 @@ |
328 | 328 | |
329 | 329 | $page->addMarkedTag( $newrevision, $changed ); |
330 | 330 | |
| 331 | + // Re-generate caches |
331 | 332 | MessageIndex::cache( NS_TRANSLATIONS ); |
| 333 | + $page->getTranslationPercentages( true ); |
| 334 | + |
332 | 335 | return false; |
333 | 336 | } |
334 | 337 | |
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -384,7 +384,7 @@ |
385 | 385 | $pers = $page->getTranslationPercentages(); |
386 | 386 | $per = @$pers[$title->getSubpageText()]; |
387 | 387 | $per = ($per === null) ? 0 : $per * 100; |
388 | | - $titleText = $page->getTitle()->getText(); |
| 388 | + $titleText = $page->getTitle()->getPrefixedText(); |
389 | 389 | $url = $page->getTranslationUrl( $title->getSubpageText() ); |
390 | 390 | |
391 | 391 | // Output |