r41482 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41481‎ | r41482 | r41483 >
Date:15:12, 1 October 2008
Author:ialex
Status:old
Tags:
Comment:
* Also check for false in the returned value of memcached
* Removed useless param passed to the SpecialPage's constructor
* Whitespaces fixes
Modified paths:
  • /trunk/extensions/SpamRegex/SpecialSpamRegex.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SpamRegex/SpecialSpamRegex.php
@@ -3,7 +3,7 @@
44 * Protect against register_globals vulnerabilities.
55 * This line must be present before any global variable is referenced.
66 */
7 -if(!defined('MEDIAWIKI'))
 7+if( !defined( 'MEDIAWIKI' ) )
88 die();
99
1010 class SpamRegex extends SpecialPage {
@@ -12,7 +12,7 @@
1313 * Constructor
1414 */
1515 function __construct() {
16 - parent::__construct( 'SpamRegex', 'spamregex', true, 'execute', false );
 16+ parent::__construct( 'SpamRegex', 'spamregex' );
1717 wfLoadExtensionMessages( 'SpamRegex' );
1818 }
1919
@@ -49,7 +49,7 @@
5050 $sRL->showSuccess();
5151 $sRF->showForm('');
5252 } else if ( 'failure_unblock' == $action ) {
53 - $text = htmlspecialchars ($wgRequest->getVal( 'text' ) );
 53+ $text = htmlspecialchars( $wgRequest->getVal( 'text' ) );
5454 $sRF->showForm( wfMsg( 'spamregex-error-unblocking', $text ) );
5555 } else if ( $wgRequest->wasPosted() && 'submit' == $action &&
5656 $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
@@ -107,10 +107,10 @@
108108
109109 $wgOut->addWikiMsg( 'spamregex-currently-blocked' );
110110 /* get data and play with data */
111 - $dbr = wfGetDB( DB_SLAVE );
112111 if ( !$this->fetchNumResults() ) {
113112 $wgOut->addWikiMsg( 'spamregex-no-currently-blocked' );
114113 } else {
 114+ $dbr = wfGetDB( DB_SLAVE );
115115 $titleObj = SpecialPage::getTitleFor( 'SpamRegex' );
116116 $action = $titleObj->escapeLocalURL( self::getListBits() );
117117 $action_unblock = $titleObj->escapeLocalURL( 'action=delete&'.self::getListBits() );
@@ -176,7 +176,7 @@
177177 $key = wfSpamRegexCacheKey( 'spamRegexCore', 'numResults' );
178178 $cached = $wgMemc->get( $key );
179179 $results = 0;
180 - if ( is_null( $cached ) ) {
 180+ if ( is_null( $cached ) || $cached === false ) {
181181 $dbr = wfGetDB( DB_SLAVE );
182182 $results = $dbr->selectField( 'spam_regex', 'COUNT(*)', '', __METHOD__ );
183183 $wgMemc->set( $key, $results, SPAMREGEX_EXPIRE );

Status & tagging log