r91794 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91793‎ | r91794 | r91795 >
Date:18:13, 9 July 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Add purge cache override
Modified paths:
  • /trunk/extensions/Translate/specials/SpecialLanguageStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php
@@ -5,7 +5,7 @@
66 * @file
77 * @author Siebrand Mazeland
88 * @author Niklas Laxström
9 - * @copyright Copyright © 2008-2010 Siebrand Mazeland, Niklas Laxström
 9+ * @copyright Copyright © 2008-2011 Siebrand Mazeland, Niklas Laxström
1010 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1111 */
1212
@@ -21,6 +21,8 @@
2222 * @ingroup SpecialPage TranslateSpecialPage Stats
2323 */
2424 class SpecialLanguageStats extends IncludableSpecialPage {
 25+ protected $purge = false;
 26+
2527 function __construct() {
2628 parent::__construct( 'LanguageStats' );
2729 }
@@ -28,6 +30,7 @@
2931 function execute( $par ) {
3032 global $wgRequest, $wgOut, $wgUser;
3133
 34+ $this->purge = $wgRequest->getVal( 'action' ) === 'purge';
3235 $this->linker = $wgUser->getSkin();
3336 $this->translate = SpecialPage::getTitleFor( 'Translate' );
3437
@@ -307,6 +310,7 @@
308311 $this->totals[1] += $translated;
309312 $this->totals[0] += $fuzzy;
310313 }
 314+
311315 if ( $total == 0 ) {
312316 $zero = serialize( $total );
313317 error_log( __METHOD__ . ": Group $groupName has zero message ($code): $zero" );
@@ -344,7 +348,7 @@
345349
346350
347351 $result = $cache->get( $id, $code );
348 - if ( is_array( $result ) ) {
 352+ if ( !$this->purge && is_array( $result ) ) {
349353 wfProfileOut( __METHOD__ );
350354 return $result;
351355 }

Status & tagging log