r70392 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70391‎ | r70392 | r70393 >
Date:17:56, 3 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
When marking page for translation, purge the completion percentages.

If the stats are not purged, Special:LanguageStats will be stuck displaying
100%. This is bad, since translators use that page to find stuff that needs
updating. Also at 100% it links to task 'review', which does not purge
stats like task 'untranslated' does. Before one would need manual whole cache
purge, or edit one message in that group to purge completion percentage
what that particular language.
Modified paths:
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)
  • /trunk/extensions/Translate/utils/MemoryCache.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -509,9 +509,9 @@
510510 $this->setupRenderJobs( $page );
511511
512512 // Re-generate caches
 513+ $page->getTranslationPercentages( /*re-generate*/ true );
 514+ ArrayMemoryCache::factory( 'groupstats' )->clearGroup( 'page|' . $page->getTitle()->getPrefixedText() );
513515 MessageIndexRebuilder::execute();
514 - $page->getTranslationPercentages( /*re-generate*/ true );
515 -
516516 return false;
517517 }
518518
Index: trunk/extensions/Translate/utils/MemoryCache.php
@@ -19,6 +19,11 @@
2020 $this->save();
2121 }
2222
 23+ public function factory( $table ) {
 24+ // __CLASS__ doesn't work, but this is PHP
 25+ return new ArrayMemoryCache( $table );
 26+ }
 27+
2328 public function get( $group, $code ) {
2429 $this->load();
2530
@@ -51,6 +56,11 @@
5257 }
5358 }
5459
 60+ public function clearGroup( $group ) {
 61+ $this->load();
 62+ unset( $this->cache[$group] );
 63+ }
 64+
5565 public function clearAll() {
5666 $this->load();
5767 $this->cache = array();

Follow-up revisions

RevisionCommit summaryAuthorDate
r709331.16wmf4: Functional merge of r70390, r70392 (real merge causes a mess becaus...catrope09:33, 12 August 2010

Status & tagging log