From a90a0783de6c6a817abec4f947598024243b02ca Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Sun, 20 Jun 2010 17:48:21 +0000 Subject: [PATCH] Nuke $db->freeResult() from Api stuffs --- includes/api/ApiPageSet.php | 4 +--- includes/api/ApiQueryAllCategories.php | 1 - includes/api/ApiQueryAllLinks.php | 1 - includes/api/ApiQueryAllUsers.php | 2 -- includes/api/ApiQueryAllimages.php | 1 - includes/api/ApiQueryAllpages.php | 1 - includes/api/ApiQueryBacklinks.php | 2 -- includes/api/ApiQueryCategories.php | 2 -- includes/api/ApiQueryCategoryInfo.php | 1 - includes/api/ApiQueryCategoryMembers.php | 1 - includes/api/ApiQueryDeletedrevs.php | 1 - includes/api/ApiQueryDuplicateFiles.php | 1 - includes/api/ApiQueryExtLinksUsage.php | 1 - includes/api/ApiQueryExternalLinks.php | 1 - includes/api/ApiQueryFilearchive.php | 1 - includes/api/ApiQueryIWBacklinks.php | 1 - includes/api/ApiQueryIWLinks.php | 1 - includes/api/ApiQueryImages.php | 2 -- includes/api/ApiQueryInfo.php | 4 ---- includes/api/ApiQueryLangLinks.php | 1 - includes/api/ApiQueryLinks.php | 2 -- includes/api/ApiQueryLogEvents.php | 2 -- includes/api/ApiQueryProtectedTitles.php | 2 +- includes/api/ApiQueryRandom.php | 2 +- includes/api/ApiQueryRecentChanges.php | 2 -- includes/api/ApiQueryRevisions.php | 1 - includes/api/ApiQuerySiteinfo.php | 1 - includes/api/ApiQueryUserContributions.php | 3 --- includes/api/ApiQueryWatchlist.php | 2 -- 29 files changed, 3 insertions(+), 44 deletions(-) diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index 7010d8fed5..554ae76839 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -472,7 +472,6 @@ class ApiPageSet extends ApiQueryBase { // Store any extra fields requested by modules $this->processDbRow( $row ); } - $db->freeResult( $res ); if ( isset( $remaining ) ) { // Any items left in the $remaining list are added as missing @@ -527,7 +526,6 @@ class ApiPageSet extends ApiQueryBase { $pageids[$pageid] = ''; unset( $remaining[$revid] ); } - $db->freeResult( $res ); $this->profileDBOut(); $this->mMissingRevIDs = array_keys( $remaining ); @@ -606,7 +604,7 @@ class ApiPageSet extends ApiQueryBase { } $this->mRedirectTitles[$from] = $to; } - $db->freeResult( $res ); + if ( $this->mPendingRedirectIDs ) { // We found pages that aren't in the redirect table // Add them diff --git a/includes/api/ApiQueryAllCategories.php b/includes/api/ApiQueryAllCategories.php index cca846a34a..be2d9cf4b6 100644 --- a/includes/api/ApiQueryAllCategories.php +++ b/includes/api/ApiQueryAllCategories.php @@ -117,7 +117,6 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase { } } } - $db->freeResult( $res ); if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'c' ); diff --git a/includes/api/ApiQueryAllLinks.php b/includes/api/ApiQueryAllLinks.php index cf6d2abebe..ced7e0c535 100644 --- a/includes/api/ApiQueryAllLinks.php +++ b/includes/api/ApiQueryAllLinks.php @@ -145,7 +145,6 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase { $pageids[] = $row->pl_from; } } - $db->freeResult( $res ); if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'l' ); diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index 85a203f27c..fcb8ba18d7 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -187,8 +187,6 @@ class ApiQueryAllUsers extends ApiQueryBase { } } - $db->freeResult( $res ); - $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'u' ); } diff --git a/includes/api/ApiQueryAllimages.php b/includes/api/ApiQueryAllimages.php index 8692e1bcd0..b8946e8331 100644 --- a/includes/api/ApiQueryAllimages.php +++ b/includes/api/ApiQueryAllimages.php @@ -134,7 +134,6 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase { $titles[] = Title::makeTitle( NS_IMAGE, $row->img_name ); } } - $db->freeResult( $res ); if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'img' ); diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index f9b503b2f3..61f3414156 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -174,7 +174,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $resultPageSet->processDbRow( $row ); } } - $db->freeResult( $res ); if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'p' ); diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index a78bf08c80..4faba6f86f 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -232,7 +232,6 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $resultPageSet->processDbRow( $row ); } } - $db->freeResult( $res ); if ( $this->redirect && count( $this->redirTitles ) ) { $this->resetQueryParams(); @@ -258,7 +257,6 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $resultPageSet->processDbRow( $row ); } } - $db->freeResult( $res ); } if ( is_null( $resultPageSet ) ) { // Try to add the result data in one go and pray that it fits diff --git a/includes/api/ApiQueryCategories.php b/includes/api/ApiQueryCategories.php index ff52598997..fb7bd14dba 100644 --- a/includes/api/ApiQueryCategories.php +++ b/includes/api/ApiQueryCategories.php @@ -174,8 +174,6 @@ class ApiQueryCategories extends ApiQueryGeneratorBase { } $resultPageSet->populateFromTitles( $titles ); } - - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryCategoryInfo.php b/includes/api/ApiQueryCategoryInfo.php index f4f952218d..17ddf0c0db 100644 --- a/includes/api/ApiQueryCategoryInfo.php +++ b/includes/api/ApiQueryCategoryInfo.php @@ -93,7 +93,6 @@ class ApiQueryCategoryInfo extends ApiQueryBase { break; } } - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryCategoryMembers.php b/includes/api/ApiQueryCategoryMembers.php index 774e5969c7..479a804f35 100644 --- a/includes/api/ApiQueryCategoryMembers.php +++ b/includes/api/ApiQueryCategoryMembers.php @@ -160,7 +160,6 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase { } $lastSortKey = $row->cl_sortkey; // detect duplicate sortkeys } - $db->freeResult( $res ); if ( is_null( $resultPageSet ) ) { $this->getResult()->setIndexedTagName_internal( diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 49bfafb40a..47406211c6 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -248,7 +248,6 @@ class ApiQueryDeletedrevs extends ApiQueryBase { break; } } - $db->freeResult( $res ); $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'page' ); } diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index 6be546ef21..494ea09550 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -121,7 +121,6 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { if ( !is_null( $resultPageSet ) ) { $resultPageSet->populateFromTitles( $titles ); } - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index 34e3c9428f..c17f0af445 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -141,7 +141,6 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { $resultPageSet->processDbRow( $row ); } } - $db->freeResult( $res ); if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index 057ecfac63..bc33f3399f 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -82,7 +82,6 @@ class ApiQueryExternalLinks extends ApiQueryBase { break; } } - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index 70c8a98be6..08a75e3346 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -166,7 +166,6 @@ class ApiQueryFilearchive extends ApiQueryBase { break; } } - $db->freeResult( $res ); $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'fa' ); } diff --git a/includes/api/ApiQueryIWBacklinks.php b/includes/api/ApiQueryIWBacklinks.php index 3324bfa3ed..bc4c6cd6a9 100644 --- a/includes/api/ApiQueryIWBacklinks.php +++ b/includes/api/ApiQueryIWBacklinks.php @@ -111,7 +111,6 @@ class ApiQueryIWBacklinks extends ApiQueryBase { break; } } - $db->freeResult( $res ); $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), diff --git a/includes/api/ApiQueryIWLinks.php b/includes/api/ApiQueryIWLinks.php index 7d13f07494..b932c1185c 100644 --- a/includes/api/ApiQueryIWLinks.php +++ b/includes/api/ApiQueryIWLinks.php @@ -107,7 +107,6 @@ class ApiQueryIWLinks extends ApiQueryBase { break; } } - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryImages.php b/includes/api/ApiQueryImages.php index b6dfc1aa8c..1804ce4f3c 100644 --- a/includes/api/ApiQueryImages.php +++ b/includes/api/ApiQueryImages.php @@ -120,8 +120,6 @@ class ApiQueryImages extends ApiQueryGeneratorBase { } $resultPageSet->populateFromTitles( $titles ); } - - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php index 88d2166a37..15bb1a85f8 100644 --- a/includes/api/ApiQueryInfo.php +++ b/includes/api/ApiQueryInfo.php @@ -416,7 +416,6 @@ class ApiQueryInfo extends ApiQueryBase { } } } - $db->freeResult( $res ); } // Get protections for missing titles @@ -434,7 +433,6 @@ class ApiQueryInfo extends ApiQueryBase { 'expiry' => Block::decodeExpiry( $row->pt_expiry, TS_ISO_8601 ) ); } - $db->freeResult( $res ); } // Cascading protections @@ -470,7 +468,6 @@ class ApiQueryInfo extends ApiQueryBase { 'source' => $source->getPrefixedText() ); } - $db->freeResult( $res ); } if ( count( $images ) ) { @@ -494,7 +491,6 @@ class ApiQueryInfo extends ApiQueryBase { 'source' => $source->getPrefixedText() ); } - $db->freeResult( $res ); } } diff --git a/includes/api/ApiQueryLangLinks.php b/includes/api/ApiQueryLangLinks.php index 10aad5a5a7..d4fc38fdd3 100644 --- a/includes/api/ApiQueryLangLinks.php +++ b/includes/api/ApiQueryLangLinks.php @@ -94,7 +94,6 @@ class ApiQueryLangLinks extends ApiQueryBase { break; } } - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryLinks.php b/includes/api/ApiQueryLinks.php index 202b772871..5f5cf92cdb 100644 --- a/includes/api/ApiQueryLinks.php +++ b/includes/api/ApiQueryLinks.php @@ -178,8 +178,6 @@ class ApiQueryLinks extends ApiQueryGeneratorBase { } $resultPageSet->populateFromTitles( $titles ); } - - $db->freeResult( $res ); } public function getAllowedParams() { diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 5d453ee746..28587266f6 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -171,8 +171,6 @@ class ApiQueryLogEvents extends ApiQueryBase { break; } } - $db->freeResult( $res ); - $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' ); } diff --git a/includes/api/ApiQueryProtectedTitles.php b/includes/api/ApiQueryProtectedTitles.php index 7f758fcff5..0162b8899e 100644 --- a/includes/api/ApiQueryProtectedTitles.php +++ b/includes/api/ApiQueryProtectedTitles.php @@ -123,7 +123,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase { $titles[] = $title; } } - $db->freeResult( $res ); + if ( is_null( $resultPageSet ) ) { $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $this->getModulePrefix() ); } else { diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index 85863abc1c..5085b9e261 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -87,7 +87,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { $resultPageSet->processDbRow( $row ); } } - $db->freeResult( $res ); + return $count; } diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index abace8f803..ae2bef029f 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -273,8 +273,6 @@ class ApiQueryRecentChanges extends ApiQueryBase { } } - $db->freeResult( $res ); - /* Format the result */ $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'rc' ); } diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 079382696c..93cc2a18ca 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -345,7 +345,6 @@ class ApiQueryRevisions extends ApiQueryBase { break; } } - $db->freeResult( $res ); } private function extractRowInfo( $row ) { diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index 5ec4e32158..f4e664575c 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -271,7 +271,6 @@ class ApiQuerySiteinfo extends ApiQueryBase { $data[] = $val; } - $db->freeResult( $res ); $this->getResult()->setIndexedTagName( $data, 'iw' ); return $this->getResult()->addValue( 'query', $property, $data ); diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 24a03b7741..a337c1d7d5 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -114,9 +114,6 @@ class ApiQueryContributions extends ApiQueryBase { } } - // Free the database record so the connection can get on with other stuff - $db->freeResult( $res ); - $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' ); } diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 4482485c79..b02f6ecda9 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -202,8 +202,6 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { } } - $db->freeResult( $res ); - if ( is_null( $resultPageSet ) ) { $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' ); } elseif ( $params['allrev'] ) { -- 2.20.1