Conditionals in loops to foreachs

This commit is contained in:
Sam Reed 2010-10-29 21:30:20 +00:00
parent df1aa3a228
commit 272013d0f2
4 changed files with 4 additions and 4 deletions

View file

@ -155,7 +155,7 @@ class AbuseFilterHooks {
array( 'abuse_filter' => array( 'INNER JOIN', 'afa_filter=af_id' ) )
);
while ( $row = $res->fetchObject() ) {
foreach ( $res as $row ) {
$emptyTags = array_filter(
array_merge( explode( "\n", $row->afa_parameters ), $emptyTags )
);

View file

@ -330,7 +330,7 @@ class AFComputedVariable {
);
$users = array();
while ( $user = $dbr->fetchRow( $res ) ) {
foreach ( $res as $user ) {
$users[] = $user[0];
}
$result = $users;

View file

@ -97,7 +97,7 @@ class ApiQueryAbuseFilters extends ApiQueryBase {
$showhidden = $wgUser->isAllowed( 'abusefilter-modify' );
$count = 0;
while ( $row = $res->fetchObject() ) {
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've had enough
$this->setContinueEnumParameter( 'startid', $row->af_id );

View file

@ -104,7 +104,7 @@ class ApiQueryAbuseLog extends ApiQueryBase {
$res = $this->select( __METHOD__ );
$count = 0;
while ( $row = $res->fetchObject() ) {
foreach ( $res as $row ) {
if ( ++$count > $params['limit'] ) {
// We've had enough
$this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->afl_timestamp ) );