http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70392

Revision: 70392
Author:   nikerabbit
Date:     2010-08-03 17:56:08 +0000 (Tue, 03 Aug 2010)

Log Message:
-----------
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
    trunk/extensions/Translate/utils/MemoryCache.php

Modified: trunk/extensions/Translate/tag/SpecialPageTranslation.php
===================================================================
--- trunk/extensions/Translate/tag/SpecialPageTranslation.php   2010-08-03 
17:47:10 UTC (rev 70391)
+++ trunk/extensions/Translate/tag/SpecialPageTranslation.php   2010-08-03 
17:56:08 UTC (rev 70392)
@@ -509,9 +509,9 @@
                $this->setupRenderJobs( $page );
 
                // Re-generate caches
+               $page->getTranslationPercentages( /*re-generate*/ true );
+               ArrayMemoryCache::factory( 'groupstats' )->clearGroup( 'page|' 
. $page->getTitle()->getPrefixedText() );
                MessageIndexRebuilder::execute();
-               $page->getTranslationPercentages( /*re-generate*/ true );
-
                return false;
        }
 

Modified: trunk/extensions/Translate/utils/MemoryCache.php
===================================================================
--- trunk/extensions/Translate/utils/MemoryCache.php    2010-08-03 17:47:10 UTC 
(rev 70391)
+++ trunk/extensions/Translate/utils/MemoryCache.php    2010-08-03 17:56:08 UTC 
(rev 70392)
@@ -19,6 +19,11 @@
                $this->save();
        }
 
+       public function factory( $table ) {
+               // __CLASS__ doesn't work, but this is PHP
+               return new ArrayMemoryCache( $table );
+       }
+
        public function get( $group, $code ) {
                $this->load();
 
@@ -51,6 +56,11 @@
                }
        }
 
+       public function clearGroup( $group ) {
+               $this->load();
+               unset( $this->cache[$group] );
+       }
+
        public function clearAll() {
                $this->load();
                $this->cache = array();



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to