From: Chad Horohoe Date: Sun, 8 Aug 2010 12:27:48 +0000 (+0000) Subject: Big commit: kill almost every freeResult() call as useless X-Git-Tag: 1.31.0-rc.0~35619 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=4c74490bb81c891fc450f21899ed462af652e978;p=lhc%2Fweb%2Fwiklou.git Big commit: kill almost every freeResult() call as useless --- diff --git a/config/Installer.php b/config/Installer.php index a41dd7a7a3..7ebc8bdd97 100644 --- a/config/Installer.php +++ b/config/Installer.php @@ -1256,7 +1256,6 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) { break; } } - $wgDatabase->freeResult( $res ); if ( !$found && $conf->DBengine != 'MyISAM' ) { echo "
  • Warning: " . htmlspecialchars( $conf->DBengine ) . " storage engine not available, " . diff --git a/includes/Article.php b/includes/Article.php index a8ad0c407e..679bfcd890 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2788,8 +2788,6 @@ class Article { $onlyAuthor = false; } - $dbw->freeResult( $res ); - // Generate the summary with a '$1' placeholder if ( $blank ) { // The current revision is blank and the one before is also @@ -4311,8 +4309,6 @@ class Article { } } - $dbr->freeResult( $res ); - return $result; } @@ -4343,8 +4339,6 @@ class Article { } } - $dbr->freeResult( $res ); - return $result; } diff --git a/includes/LinksUpdate.php b/includes/LinksUpdate.php index 5fb7c05da6..af05746f75 100644 --- a/includes/LinksUpdate.php +++ b/includes/LinksUpdate.php @@ -640,7 +640,6 @@ class LinksUpdate { } $arr[$row->pl_namespace][$row->pl_title] = 1; } - $this->mDb->freeResult( $res ); return $arr; } @@ -658,7 +657,6 @@ class LinksUpdate { } $arr[$row->tl_namespace][$row->tl_title] = 1; } - $this->mDb->freeResult( $res ); return $arr; } @@ -673,7 +671,6 @@ class LinksUpdate { while ( $row = $this->mDb->fetchObject( $res ) ) { $arr[$row->il_to] = 1; } - $this->mDb->freeResult( $res ); return $arr; } @@ -688,7 +685,6 @@ class LinksUpdate { while ( $row = $this->mDb->fetchObject( $res ) ) { $arr[$row->el_to] = 1; } - $this->mDb->freeResult( $res ); return $arr; } @@ -703,7 +699,6 @@ class LinksUpdate { while ( $row = $this->mDb->fetchObject( $res ) ) { $arr[$row->cl_to] = $row->cl_sortkey; } - $this->mDb->freeResult( $res ); return $arr; } @@ -736,7 +731,6 @@ class LinksUpdate { } $arr[$row->iwl_prefix][$row->iwl_title] = 1; } - $this->mDb->freeResult( $res ); return $arr; } @@ -751,7 +745,6 @@ class LinksUpdate { while ( $row = $this->mDb->fetchObject( $res ) ) { $arr[$row->pp_propname] = $row->pp_value; } - $this->mDb->freeResult( $res ); return $arr; } diff --git a/includes/QueryPage.php b/includes/QueryPage.php index b34768c272..619c1011fb 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -264,13 +264,9 @@ class QueryPage { if ( count( $vals ) ) { if ( !$dbw->insert( 'querycache', $vals, __METHOD__ ) ) { // Set result to false to indicate error - $dbr->freeResult( $res ); $res = false; } } - if ( $res ) { - $dbr->freeResult( $res ); - } if ( $ignoreErrors ) { $dbw->ignoreErrors( $ignoreW ); $dbr->ignoreErrors( $ignoreR ); @@ -492,7 +488,6 @@ class QueryPage { $item = $this->feedResult( $obj ); if( $item ) $feed->outItem( $item ); } - $dbr->freeResult( $res ); $feed->outFooter(); return true; diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 38c6b74b2a..81e3b128ec 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -73,7 +73,6 @@ class RecentChange { $res = $dbr->select( 'recentchanges', '*', array( 'rc_id' => $rcid ), __METHOD__ ); if( $res && $dbr->numRows( $res ) > 0 ) { $row = $dbr->fetchObject( $res ); - $dbr->freeResult( $res ); return self::newFromRow( $row ); } else { return null; diff --git a/includes/SquidUpdate.php b/includes/SquidUpdate.php index 8944df8adf..d0fe51bc5b 100644 --- a/includes/SquidUpdate.php +++ b/includes/SquidUpdate.php @@ -46,7 +46,6 @@ class SquidUpdate { $blurlArr[] = $tobj->getInternalURL(); } } - $dbr->freeResult ( $res ) ; wfProfileOut( __METHOD__ ); return new SquidUpdate( $blurlArr ); diff --git a/includes/Title.php b/includes/Title.php index 9bb6f83eb7..b47e8cc2fb 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2804,7 +2804,6 @@ class Title { } } } - $db->freeResult( $res ); return $retVal; } @@ -3553,7 +3552,6 @@ class Title { foreach ( $res as $row ) // $data[] = Title::newFromText($wgContLang->getNSText ( NS_CATEGORY ).':'.$row->cl_to); $data[$wgContLang->getNSText( NS_CATEGORY ) . ':' . $row->cl_to] = $this->getFullText(); - $dbr->freeResult( $res ); } else { $data = array(); } diff --git a/includes/WatchedItem.php b/includes/WatchedItem.php index d1c152963a..1fd6e31382 100644 --- a/includes/WatchedItem.php +++ b/includes/WatchedItem.php @@ -150,7 +150,6 @@ class WatchedItem { 'wl_title' => $newtitle ); } - $dbw->freeResult( $res ); if( empty( $values ) ) { // Nothing to do diff --git a/includes/db/Database.php b/includes/db/Database.php index 5ebf0d560b..54eb32c317 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -786,7 +786,6 @@ abstract class DatabaseBase { } $row = $this->fetchRow( $res ); if ( $row !== false ) { - $this->freeResult( $res ); return reset( $row ); } else { return false; @@ -947,13 +946,10 @@ abstract class DatabaseBase { if ( $res === false ) return false; if ( !$this->numRows($res) ) { - $this->freeResult($res); return false; } $obj = $this->fetchObject( $res ); - $this->freeResult( $res ); return $obj; - } /** @@ -976,7 +972,6 @@ abstract class DatabaseBase { $row = $this->fetchRow( $res ); $rows = ( isset( $row['rowcount'] ) ) ? $row['rowcount'] : 0; } - $this->freeResult( $res ); return $rows; } @@ -1056,7 +1051,6 @@ abstract class DatabaseBase { $result[] = $row; } } - $this->freeResult($res); return empty($result) ? false : $result; } @@ -1069,12 +1063,7 @@ abstract class DatabaseBase { $old = $this->ignoreErrors( true ); $res = $this->query( "SELECT 1 FROM $table LIMIT 1" ); $this->ignoreErrors( $old ); - if( $res ) { - $this->freeResult( $res ); - return true; - } else { - return false; - } + return (bool)$res; } /** @@ -1658,7 +1647,6 @@ abstract class DatabaseBase { $sql = "SHOW COLUMNS FROM $table LIKE \"$field\";"; $res = $this->query( $sql, 'Database::textFieldSize' ); $row = $this->fetchObject( $res ); - $this->freeResult( $res ); $m = array(); if ( preg_match( '/\((.*)\)/', $row->Type, $m ) ) { @@ -1926,7 +1914,6 @@ abstract class DatabaseBase { $sql = "SELECT MASTER_POS_WAIT($encFile, $encPos, $timeout)"; $res = $this->doQuery( $sql ); if ( $res && $row = $this->fetchRow( $res ) ) { - $this->freeResult( $res ); wfProfileOut( $fname ); return $row[0]; } else { diff --git a/includes/db/DatabaseIbm_db2.php b/includes/db/DatabaseIbm_db2.php index be3851abbd..f74721ab68 100644 --- a/includes/db/DatabaseIbm_db2.php +++ b/includes/db/DatabaseIbm_db2.php @@ -1005,7 +1005,6 @@ EOF; $res = $this->query( "VALUES NEXTVAL FOR $safeseq" ); $row = $this->fetchRow( $res ); $this->mInsertId = $row[0]; - $this->freeResult( $res ); return $this->mInsertId; */ return null; @@ -1604,7 +1603,6 @@ SQL; $res = $this->query($sql); $row = $this->fetchObject($res); $size = $row->size; - $this->freeResult( $res ); return $size; } diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php index a8b7d86c5c..f972027a61 100644 --- a/includes/db/DatabaseMssql.php +++ b/includes/db/DatabaseMssql.php @@ -327,7 +327,6 @@ class DatabaseMssql extends DatabaseBase { if ( $res ) { $row = $this->fetchRow( $res ); if ( isset( $row['EstimateRows'] ) ) $rows = $row['EstimateRows']; - $this->freeResult( $res ); } return $rows; } @@ -666,7 +665,6 @@ class DatabaseMssql extends DatabaseBase { $row = $this->fetchRow( $res ); $size = -1; if ( strtolower( $row['DATA_TYPE'] ) != 'text' ) $size = $row['CHARACTER_MAXIMUM_LENGTH']; - $this->freeResult( $res ); return $size; } diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index c49470b27e..b221893b71 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -256,7 +256,6 @@ class DatabaseMysql extends DatabaseBase { if ( $res === false ) return false; if ( !$this->numRows( $res ) ) { - $this->freeResult($res); return 0; } @@ -264,8 +263,6 @@ class DatabaseMysql extends DatabaseBase { while( $plan = $this->fetchObject( $res ) ) { $rows *= $plan->rows > 0 ? $plan->rows : 1; // avoid resetting to zero } - - $this->freeResult($res); return $rows; } @@ -382,7 +379,6 @@ class DatabaseMysql extends DatabaseBase { $lockName = $this->addQuotes( $lockName ); $result = $this->query( "SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method ); $row = $this->fetchObject( $result ); - $this->freeResult( $result ); if( $row->lockstatus == 1 ) { return true; diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 8bfcf2bb00..4cdea739b4 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -654,7 +654,6 @@ class DatabaseOracle extends DatabaseBase { $res = $this->query( "SELECT $seqName.nextval FROM dual" ); $row = $this->fetchRow( $res ); $this->mInsertId = $row[0]; - $this->freeResult( $res ); return $this->mInsertId; } diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 34bf99cc71..b956a6b79f 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -726,7 +726,6 @@ class DatabasePostgres extends DatabaseBase { if( preg_match( '/rows=(\d+)/', $row[0], $count ) ) { $rows = $count[1]; } - $this->freeResult($res); } return $rows; } @@ -993,7 +992,6 @@ class DatabasePostgres extends DatabaseBase { $res = $this->query( "SELECT nextval('$safeseq')" ); $row = $this->fetchRow( $res ); $this->mInsertId = $row[0]; - $this->freeResult( $res ); return $this->mInsertId; } @@ -1005,7 +1003,6 @@ class DatabasePostgres extends DatabaseBase { $res = $this->query( "SELECT currval('$safeseq')" ); $row = $this->fetchRow( $res ); $currval = $row[0]; - $this->freeResult( $res ); return $currval; } @@ -1098,7 +1095,6 @@ class DatabasePostgres extends DatabaseBase { } else { $size=$row->size; } - $this->freeResult( $res ); return $size; } @@ -1188,8 +1184,6 @@ class DatabasePostgres extends DatabaseBase { . "AND c.relkind IN ('" . implode("','", $types) . "')"; $res = $this->query( $SQL ); $count = $res ? $res->numRows() : 0; - if ($res) - $this->freeResult( $res ); return $count ? true : false; } @@ -1221,7 +1215,6 @@ SQL; if (!$res) return null; $rows = $res->numRows(); - $this->freeResult( $res ); return $rows; } @@ -1245,7 +1238,6 @@ SQL; if (!$res) return null; $rows = $res->numRows(); - $this->freeResult($res); return $rows; } @@ -1263,8 +1255,6 @@ SQL; } else { $owner = false; } - if ($res) - $this->freeResult($res); return $owner; } diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index a9c6437f46..a3b62f856d 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -893,7 +893,6 @@ abstract class File { } } } - $db->freeResult( $res ); wfProfileOut( __METHOD__ ); return $retVal; } diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 3dd294cb7d..86ee34db05 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -697,12 +697,10 @@ class LocalFile extends File { $fname ); if ( 0 == $dbr->numRows( $this->historyRes ) ) { - $dbr->freeResult( $this->historyRes ); $this->historyRes = null; return false; } } elseif ( $this->historyLine == 1 ) { - $dbr->freeResult( $this->historyRes ); $this->historyRes = $dbr->select( 'oldimage', '*', array( 'oi_name' => $this->title->getDBkey() ), $fname, @@ -720,7 +718,6 @@ class LocalFile extends File { public function resetHistory() { $this->historyLine = 0; if ( !is_null( $this->historyRes ) ) { - $this->repo->getSlaveDB()->freeResult( $this->historyRes ); $this->historyRes = null; } } @@ -1827,7 +1824,6 @@ class LocalFileMoveBatch { "{$archiveBase}/{$this->newHash}{$timestamp}!{$this->newName}" ); } - $this->db->freeResult( $result ); } /** diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index ec6a09e4ac..fcbac9ea5b 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -241,7 +241,6 @@ class AllmessagesTablePager extends TablePager { $talkFlags[$s->page_title] = true; } } - $dbr->freeResult( $res ); wfProfileOut( __METHOD__ . '-db' ); diff --git a/includes/specials/SpecialDisambiguations.php b/includes/specials/SpecialDisambiguations.php index 3da912e4f4..0081331ae7 100644 --- a/includes/specials/SpecialDisambiguations.php +++ b/includes/specials/SpecialDisambiguations.php @@ -67,8 +67,6 @@ class DisambiguationsPage extends PageQueryPage { while ( $row = $dbr->fetchObject( $res ) ) { $linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title )); } - - $dbr->freeResult( $res ); } $set = $linkBatch->constructSet( 'lb.tl', $dbr ); diff --git a/includes/specials/SpecialDoubleRedirects.php b/includes/specials/SpecialDoubleRedirects.php index 566f8f6953..30f84f0c20 100644 --- a/includes/specials/SpecialDoubleRedirects.php +++ b/includes/specials/SpecialDoubleRedirects.php @@ -85,7 +85,6 @@ class DoubleRedirectsPage extends PageQueryPage { $res = $dbr->query( $sql, $fname ); if ( $res ) { $result = $dbr->fetchObject( $res ); - $dbr->freeResult( $res ); } } if ( !$result ) { diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index cec5c47f00..86e8a1f793 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -319,9 +319,6 @@ class SpecialExport extends SpecialPage { $pages[] = $n; } - - $dbr->freeResult($res); - return $pages; } @@ -349,9 +346,6 @@ class SpecialExport extends SpecialPage { $pages[] = $n; } - - $dbr->freeResult( $res ); - return $pages; } diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index f162ff7426..2d28295a00 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -100,7 +100,6 @@ function wfSpecialFileDuplicateSearch( $par = null ) { if( $row !== false ) { $hash = $row[0]; } - $dbr->freeResult( $res ); } # Create the input form diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 0f183d16ae..91d7ee61de 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -67,7 +67,6 @@ function wfSpecialNewimages( $par, $specialPage ) { } else { $ts = false; } - $dbr->freeResult( $res ); $sql = ''; # If we were clever, we'd use this to cache. @@ -125,7 +124,6 @@ function wfSpecialNewimages( $par, $specialPage ) { array_push( $images, $s ); } } - $dbr->freeResult( $res ); $gallery = new ImageGallery(); $firstTimestamp = null; diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index d6628dc1da..52ac4a500f 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -386,7 +386,6 @@ function wfSpecialWatchlist( $par ) { } $s .= $list->endRecentChangesList(); - $dbr->freeResult( $res ); $wgOut->addHTML( $s ); } @@ -478,7 +477,6 @@ function wlCountItems( &$user, $talk = true ) { array( 'wl_user' => $user->mId ), 'wlCountItems' ); $row = $dbr->fetchObject( $res ); $count = $row->count; - $dbr->freeResult( $res ); # Halve to remove talk pages if needed if( !$talk ) diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index ac2f931e61..f9a0314e72 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -189,8 +189,6 @@ class SpecialWhatLinksHere extends SpecialPage { $row->is_image = 0; $rows[$row->page_id] = $row; } - $dbr->freeResult( $plRes ); - } if( !$hidetrans ) { while ( $row = $dbr->fetchObject( $tlRes ) ) { @@ -198,7 +196,6 @@ class SpecialWhatLinksHere extends SpecialPage { $row->is_image = 0; $rows[$row->page_id] = $row; } - $dbr->freeResult( $tlRes ); } if( !$hideimages ) { while ( $row = $dbr->fetchObject( $ilRes ) ) { @@ -206,7 +203,6 @@ class SpecialWhatLinksHere extends SpecialPage { $row->is_image = 1; $rows[$row->page_id] = $row; } - $dbr->freeResult( $ilRes ); } // Sort by key and then change the keys to 0-based indices diff --git a/maintenance/FiveUpgrade.inc b/maintenance/FiveUpgrade.inc index 00b532b178..fd4bb86207 100644 --- a/maintenance/FiveUpgrade.inc +++ b/maintenance/FiveUpgrade.inc @@ -336,7 +336,6 @@ class FiveUpgrade { $this->addChunk( $add ); } $this->lastChunk( $add ); - $this->dbr->freeResult( $result ); $this->log( "Done converting $name." ); $this->cleanupSwaps[] = $name; @@ -444,7 +443,6 @@ class FiveUpgrade { $this->addChunk( $add, $row->cur_id ); } $this->lastChunk( $add ); - $this->dbr->freeResult( $result ); /** * Copy revision metadata from old into revision. @@ -477,7 +475,6 @@ class FiveUpgrade { $this->addChunk( $add ); } $this->lastChunk( $add ); - $this->dbr->freeResult( $result ); /** @@ -510,7 +507,6 @@ class FiveUpgrade { $this->addChunk( $add ); } $this->lastChunk( $add ); - $this->dbr->freeResult( $result ); $this->log( "...done with cur/old -> page/revision." ); } @@ -902,7 +898,6 @@ END; $this->addChunk( $add ); } $this->lastChunk( $add ); - $this->dbr->freeResult( $result ); $this->log( 'Done converting watchlist.' ); $this->cleanupSwaps[] = 'watchlist'; diff --git a/maintenance/attachLatest.php b/maintenance/attachLatest.php index ae528bb0bd..6db5d6d44c 100644 --- a/maintenance/attachLatest.php +++ b/maintenance/attachLatest.php @@ -69,7 +69,6 @@ class AttachLatest extends Maintenance { } $n++; } - $dbw->freeResult( $result ); $this->output( "Done! Processed $n pages.\n" ); if ( !$this->hasOption( 'fix' ) ) { $this->output( "This was a dry run; rerun with --fix to update page_latest.\n" ); diff --git a/maintenance/deleteOrphanedRevisions.php b/maintenance/deleteOrphanedRevisions.php index 4986788e47..73068cc285 100644 --- a/maintenance/deleteOrphanedRevisions.php +++ b/maintenance/deleteOrphanedRevisions.php @@ -51,7 +51,6 @@ class DeleteOrphanedRevisions extends Maintenance { $revisions = array(); foreach ( $res as $row ) $revisions[] = $row->rev_id; - $dbw->freeResult( $res ); $count = count( $revisions ); $this->output( "found {$count}.\n" ); diff --git a/maintenance/dumpSisterSites.php b/maintenance/dumpSisterSites.php index bc4acd8714..75b7a00b41 100644 --- a/maintenance/dumpSisterSites.php +++ b/maintenance/dumpSisterSites.php @@ -48,7 +48,6 @@ class DumpSisterSites extends Maintenance { $text = $title->getPrefixedText(); $this->output( "$url $text\n" ); } - $dbr->freeResult( $result ); } } diff --git a/maintenance/dumpUploads.php b/maintenance/dumpUploads.php index ff6bfdd181..726153fd44 100644 --- a/maintenance/dumpUploads.php +++ b/maintenance/dumpUploads.php @@ -82,7 +82,6 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir foreach ( $result as $row ) { $this->outputItem( $row->il_to, $shared ); } - $dbr->freeResult( $result ); } /** @@ -100,7 +99,6 @@ By default, outputs relative paths against the parent directory of \$wgUploadDir foreach ( $result as $row ) { $this->outputItem( $row->img_name, $shared ); } - $dbr->freeResult( $result ); } function outputItem( $name, $shared ) { diff --git a/maintenance/fixSlaveDesync.php b/maintenance/fixSlaveDesync.php index c07ee0d550..b28251023c 100644 --- a/maintenance/fixSlaveDesync.php +++ b/maintenance/fixSlaveDesync.php @@ -66,7 +66,6 @@ class FixSlaveDesync extends Maintenance { } } $this->output( "\n" ); - $dbw->freeResult( $res ); global $slaveIndexes; foreach ( $slaveIndexes as $i ) { @@ -78,7 +77,6 @@ class FixSlaveDesync extends Maintenance { $this->output( $row->page_id . "\t" ); } } - $db->freeResult( $res ); } $this->output( "\n" ); return $desync; @@ -128,14 +126,12 @@ class FixSlaveDesync extends Maintenance { foreach ( $res as $row ) { $masterIDs[] = $row->rev_id; } - $dbw->freeResult( $res ); $res = $db->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ ); $slaveIDs = array(); foreach ( $res as $row ) { $slaveIDs[] = $row->rev_id; } - $db->freeResult( $res ); if ( count( $masterIDs ) < count( $slaveIDs ) ) { $missingIDs = array_diff( $slaveIDs, $masterIDs ); if ( count( $missingIDs ) ) { diff --git a/maintenance/fixTimestamps.php b/maintenance/fixTimestamps.php index d258287e5c..c6046ca0f8 100644 --- a/maintenance/fixTimestamps.php +++ b/maintenance/fixTimestamps.php @@ -89,7 +89,6 @@ class FixTimestamps extends Maintenance { $badRevs[] = $row->rev_id; } } - $dbw->freeResult( $res ); $numBadRevs = count( $badRevs ); if ( $numBadRevs > $numGoodRevs ) { diff --git a/maintenance/initEditCount.php b/maintenance/initEditCount.php index 02eb623bab..3ca067cb82 100644 --- a/maintenance/initEditCount.php +++ b/maintenance/initEditCount.php @@ -80,7 +80,6 @@ in $wgDBservers, usually indicating a replication environment.' ); __METHOD__ ); ++$migrated; } - $dbr->freeResult( $result ); $delta = microtime( true ) - $start; $rate = ( $delta == 0.0 ) ? 0.0 : $migrated / $delta; diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index 66af8353c5..13dfd9fb95 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -142,7 +142,6 @@ class NamespaceConflictChecker extends Maintenance { foreach ( $result as $row ) { $prefixes[] = $row->iw_prefix; } - $this->db->freeResult( $result ); return $prefixes; } @@ -214,8 +213,6 @@ class NamespaceConflictChecker extends Maintenance { foreach ( $result as $row ) { $set[] = $row; } - $this->db->freeResult( $result ); - return $set; } diff --git a/maintenance/orphans.php b/maintenance/orphans.php index 4a04a93489..a82fa407bb 100644 --- a/maintenance/orphans.php +++ b/maintenance/orphans.php @@ -184,7 +184,6 @@ class Orphans extends Maintenance { WHERE rev_page=$row->page_id " ); $row2 = $dbw->fetchObject( $result2 ); - $dbw->freeResult( $result2 ); if ( $row2 ) { if ( $row->rev_timestamp != $row2->max_timestamp ) { if ( $found == 0 ) { diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index 52cfd48d4e..578812450a 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -112,7 +112,6 @@ class ImageBuilder extends FiveUpgrade { } } $this->log( "Finished $table... $this->updated of $this->processed rows updated" ); - $this->dbr->freeResult( $result ); } function buildImage() { diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index d38a75a3fe..2b96645455 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -129,7 +129,6 @@ class RebuildRecentchanges extends Maintenance { $lastSize = 'NULL'; $new = 1; // probably true } - $dbw->freeResult( $res2 ); } if ( $lastCurId == 0 ) { $this->output( "Uhhh, something wrong? No curid\n" ); @@ -147,7 +146,6 @@ class RebuildRecentchanges extends Maintenance { $lastSize = $size; } } - $dbw->freeResult( $res ); } /** @@ -272,8 +270,6 @@ class RebuildRecentchanges extends Maintenance { $dbw->query( $sql2 ); } } - - $dbw->freeResult( $res ); } /** diff --git a/maintenance/rebuildtextindex.php b/maintenance/rebuildtextindex.php index beb7a575d7..fd2d159b3f 100644 --- a/maintenance/rebuildtextindex.php +++ b/maintenance/rebuildtextindex.php @@ -87,7 +87,6 @@ class RebuildTextIndex extends Maintenance { $u = new SearchUpdate( $s->page_id, $s->page_title, $revtext ); $u->doUpdate(); } - $this->db->freeResult( $res ); $n += self::RTI_CHUNK_SIZE; } } diff --git a/maintenance/storage/compressOld.inc b/maintenance/storage/compressOld.inc index 981cfda547..e5d5fe9c7e 100644 --- a/maintenance/storage/compressOld.inc +++ b/maintenance/storage/compressOld.inc @@ -23,7 +23,6 @@ function compressOldPages( $start = 0, $extdb = '' ) { compressPage( $row, $extdb ); $last = $row->old_id; } - $dbw->freeResult( $res ); $start = $last + 1; # Deletion may leave long empty stretches print "$start...\n"; } while( true ); diff --git a/maintenance/storage/moveToExternal.php b/maintenance/storage/moveToExternal.php index c2ed85bc19..ec1c4c658a 100644 --- a/maintenance/storage/moveToExternal.php +++ b/maintenance/storage/moveToExternal.php @@ -111,7 +111,6 @@ function moveToExternal( $cluster, $maxID, $minID = 1 ) { array( 'old_id' => $id ), $fname ); $numMoved++; } - $dbr->freeResult( $res ); } } diff --git a/maintenance/storage/resolveStubs.php b/maintenance/storage/resolveStubs.php index b32c72f479..ff1b010427 100644 --- a/maintenance/storage/resolveStubs.php +++ b/maintenance/storage/resolveStubs.php @@ -40,10 +40,7 @@ function resolveStubs() { $fname ); while ( $row = $dbr->fetchObject( $res ) ) { resolveStub( $row->old_id, $row->old_text, $row->old_flags ); - } - $dbr->freeResult( $res ); - - + } } print "100%\n"; } diff --git a/maintenance/updateArticleCount.php b/maintenance/updateArticleCount.php index 367ee07604..bf9042e73c 100644 --- a/maintenance/updateArticleCount.php +++ b/maintenance/updateArticleCount.php @@ -92,7 +92,6 @@ class UpdateArticleCount extends Maintenance { $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->query( $this->makeSql( $dbr ), __METHOD__ ); $row = $dbr->fetchObject( $res ); - $dbr->freeResult( $res ); return $row ? $row->pagecount : false; } } diff --git a/maintenance/updaters.inc b/maintenance/updaters.inc index a5e3fdcc72..86adf5a7fb 100644 --- a/maintenance/updaters.inc +++ b/maintenance/updaters.inc @@ -327,7 +327,6 @@ function check_bin( $table, $field, $patchFile ) { $tableName = $wgDatabase->tableName( $table ); $res = $wgDatabase->query( "SELECT $field FROM $tableName LIMIT 0" ); $flags = explode( ' ', mysql_field_flags( $res->result, 0 ) ); - $wgDatabase->freeResult( $res ); if ( in_array( 'binary', $flags ) ) { wfOut( "...$table table has correct $field encoding.\n" ); @@ -550,7 +549,6 @@ function do_namespace_size_on( $table, $prefix ) { $tablename = $wgDatabase->tableName( $table ); $result = $wgDatabase->query( "SHOW COLUMNS FROM $tablename LIKE '$field'" ); $info = $wgDatabase->fetchObject( $result ); - $wgDatabase->freeResult( $result ); if ( substr( $info->Type, 0, 3 ) == 'int' ) { wfOut( "...$field is already a full int ($info->Type).\n" ); @@ -698,7 +696,6 @@ function do_user_groups_update() { $fname ); } } - $wgDatabase->freeResult( $result ); wfOut( "ok\n" ); } @@ -793,7 +790,6 @@ function do_templatelinks_update() { ); } - $wgDatabase->freeResult( $res ); } else { // Fast update $wgDatabase->insertSelect( 'templatelinks', 'pagelinks', @@ -1241,14 +1237,12 @@ END; return null; } if ( !( $r = $wgDatabase->fetchRow( $res ) ) ) { - $wgDatabase->freeResult( $res ); return null; } $indkey = $r[0]; $relid = intval( $r[1] ); $indkeys = explode( " ", $indkey ); - $wgDatabase->freeResult( $res ); $colnames = array(); foreach ( $indkeys as $rid ) { @@ -1263,11 +1257,9 @@ END; return null; } if ( !( $row2 = $wgDatabase->fetchRow( $r2 ) ) ) { - $wgDatabase->freeResult( $r2 ); return null; } $colnames[] = $row2[0]; - $wgDatabase->freeResult( $r2 ); } return $colnames; @@ -1316,7 +1308,6 @@ END; return null; } $d = $row[0]; - $wgDatabase->freeResult( $r ); return $d; } diff --git a/maintenance/userDupes.inc b/maintenance/userDupes.inc index 86d5e0087a..668d0bc98c 100644 --- a/maintenance/userDupes.inc +++ b/maintenance/userDupes.inc @@ -193,8 +193,6 @@ class UserDupes { while ( $row = $this->db->fetchObject( $result ) ) { $list[] = $row->user_name; } - $this->db->freeResult( $result ); - return $list; } @@ -246,7 +244,6 @@ class UserDupes { } wfOut( "\n" ); } - $this->db->freeResult( $result ); } /**