On 2/27/07, aaron@svn.wikimedia.org aaron@svn.wikimedia.org wrote:
Revision: 20075 Author: aaron Date: 2007-02-27 14:17:35 -0800 (Tue, 27 Feb 2007)
Log Message:
- Allow /16 and /24 CIDR ips
Modified Paths:
trunk/phase3/includes/SpecialContributions.php
Modified: trunk/phase3/includes/SpecialContributions.php
--- trunk/phase3/includes/SpecialContributions.php 2007-02-27 22:06:53 UTC (rev 20074) +++ trunk/phase3/includes/SpecialContributions.php 2007-02-27 22:17:35 UTC (rev 20075) @@ -71,13 +71,18 @@ if ( $this->username == 'newbies' ) { $max = $this->dbr->selectField( 'user', 'max(user_id)', false, 'make_sql' ); $condition = '>' . (int)($max - $max / 100);
} else if ( preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/(24|16)/", $this->username) ) {
$abcd = explode( ".", $this->username );
if( substr( $this->username, -2 ) == 24 ) $ipmask = $abcd[0] . '.' . $abcd[1] . '.' . $abcd[2] . '.%';
else $ipmask=$abcd[0] . '.' . $abcd[1] . '.%';
$condition = 'rev_user_text LIKE ' . $this->dbr->addQuotes($ipmask); } if ( $condition == '' ) { $condition = ' rev_user_text=' . $this->dbr->addQuotes( $this->username ); $index = 'usertext_timestamp'; } else {
$condition = ' rev_user '.$condition ;
#$condition = ' rev_user '.$condition ;
Is it just me, or is this broken? The prefixing of rev_user later was removed, but the original instance of $condition didn't have the prefixing added. It seems to me that you'll get conditions like "WHERE > 12345", which is obviously a syntax error. The patch that this was copied from didn't have this issue, changing the "$condition = ..." line to include " rev_user". And commenting out lines rather than removing them is probably not generally good.
Incidentally, why is this still using the old 1% method of calculating newbies? Shouldn't it use user_registration?
wikitech-l@lists.wikimedia.org