X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/74c929b24b048c9f1e31e17db757ae4195cd7673..dc9cc5d707f5a612938cc9371614cc41c328fda2:/maintenance/cleanupTable.inc diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 26b0a0e2..75699c52 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -61,21 +61,19 @@ abstract class TableCleanup extends FiveUpgrade { } function runTable( $table, $where, $callback ) { - $fname = 'CapsCleanup::buildTable'; - - $count = $this->dbw->selectField( $table, 'count(*)', '', $fname ); + $count = $this->dbw->selectField( $table, 'count(*)', '', __METHOD__ ); $this->init( $count, $table ); $this->log( "Processing $table..." ); $tableName = $this->dbr->tableName( $table ); $sql = "SELECT * FROM $tableName $where"; - $result = $this->dbr->query( $sql, $fname ); + $result = $this->dbr->query( $sql, __METHOD__ ); - while( $row = $this->dbr->fetchObject( $result ) ) { + foreach( $result as $row ) { call_user_func( $callback, $row ); } $this->log( "Finished $table... $this->updated of $this->processed rows updated" ); - $this->dbr->freeResult( $result ); + $result->free(); } function hexChar( $matches ) {