From: Nick Jenkins Date: Mon, 27 Nov 2006 08:36:57 +0000 (+0000) Subject: Changing lines like this: "extract( $dbw->tableNames( 'page', 'archive' ) );" to... X-Git-Tag: 1.31.0-rc.0~55066 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=a474761d9a03ccb7a7736c97b897268c7efe0e29;p=lhc%2Fweb%2Fwiklou.git Changing lines like this: "extract( $dbw->tableNames( 'page', 'archive' ) );" to be like this: "list ($page, $archive) = $dbw->tableNamesN( 'page', 'archive' );". Three reasons for this: 1) It's better for analysis tools [which want explicit variable declaration] 2) It's easier for a human to read, as it's completely explicit where the variables came from [which is something you don't get with extract() ] 3) It makes it easier to find everywhere where a variable is used with search/grep [which you can't currently do with $tbl_page variables from things like: "extract($db->tableNames( 'page', 'revision'), EXTR_PREFIX_ALL, 'tbl');"]. Otherwise, from a functionality/efficiency perspective the two forms should be identical. By doing this have been able run static analysis over the usages of these variables, thus eliminating 5 unneeded table names from calls, plus removing 3 unused calls entirely, and it just feels subjectively slightly nicer to me. --- diff --git a/includes/Block.php b/includes/Block.php index 97b1f43e91..15b397283d 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -308,7 +308,7 @@ class Block $now = wfTimestampNow(); - extract( $db->tableNames( 'ipblocks', 'user' ) ); + list( $ipblocks, $user ) = $db->tableNamesN( 'ipblocks', 'user' ); $sql = "SELECT $ipblocks.*,user_name FROM $ipblocks,$user " . "WHERE user_id=ipb_by $cond ORDER BY ipb_timestamp DESC $options"; diff --git a/includes/Database.php b/includes/Database.php index d8f7757f78..e707546352 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -1383,7 +1383,7 @@ class Database { * $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user * WHERE wl_user=user_id AND wl_user=$nameWithQuotes"; */ - function tableNames() { + public function tableNames() { $inArray = func_get_args(); $retVal = array(); foreach ( $inArray as $name ) { @@ -1391,6 +1391,24 @@ class Database { } return $retVal; } + + /** + * @desc: Fetch a number of table names into an zero-indexed numerical array + * This is handy when you need to construct SQL for joins + * + * Example: + * list( $user, $watchlist ) = $dbr->tableNames('user','watchlist'); + * $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user + * WHERE wl_user=user_id AND wl_user=$nameWithQuotes"; + */ + public function tableNamesN() { + $inArray = func_get_args(); + $retVal = array(); + foreach ( $inArray as $name ) { + $retVal[] = $this->tableName( $name ); + } + return $retVal; + } /** * @private diff --git a/includes/Image.php b/includes/Image.php index c03466b2b7..5170536e76 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1702,7 +1702,7 @@ class Image } $linkCache =& LinkCache::singleton(); - extract( $db->tableNames( 'page', 'imagelinks' ) ); + list( $page, $imagelinks ) = $db->tableNamesN( 'page', 'imagelinks' ); $encName = $db->addQuotes( $this->name ); $sql = "SELECT page_namespace,page_title,page_id FROM $page,$imagelinks WHERE page_id=il_from AND il_to=$encName $options"; $res = $db->query( $sql, __METHOD__ ); diff --git a/includes/SiteStats.php b/includes/SiteStats.php index 4480ab5976..50a2204f40 100644 --- a/includes/SiteStats.php +++ b/includes/SiteStats.php @@ -127,7 +127,7 @@ class SiteStatsUpdate { # Update schema if required if ( $row->ss_total_pages == -1 && !$this->mViews ) { $dbr =& wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') ); - extract( $dbr->tableNames( 'page', 'user' ) ); + list( $page, $user ) = $dbr->tableNamesN( 'page', 'user' ); $sql = "SELECT COUNT(page_namespace) AS total FROM $page"; $res = $dbr->query( $sql, $fname ); diff --git a/includes/Skin.php b/includes/Skin.php index da0f507ccc..43c7695ffc 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -1034,7 +1034,7 @@ END; if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'watchlist' ) ); + $watchlist = $dbr->tableName( 'watchlist' ); $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) . "' AND wl_namespace=" . $wgTitle->getNamespace() ; diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 95bd8763c4..f804114525 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -54,6 +54,7 @@ class MediaWiki_I18N { $value = wfMsg( $value ); // interpolate variables + $m = array(); while (preg_match('/\$([0-9]*?)/sm', $value, $m)) { list($src, $var) = $m; wfSuppressWarnings(); @@ -344,7 +345,7 @@ class SkinTemplate extends Skin { if ($wgPageShowWatchingUsers) { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'watchlist' ) ); + $watchlist = $dbr->tableName( 'watchlist' ); $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) . "' AND wl_namespace=" . $this->mTitle->getNamespace() ; diff --git a/includes/SpecialBrokenRedirects.php b/includes/SpecialBrokenRedirects.php index 653e13e244..509356540c 100644 --- a/includes/SpecialBrokenRedirects.php +++ b/includes/SpecialBrokenRedirects.php @@ -27,7 +27,7 @@ class BrokenRedirectsPage extends PageQueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'pagelinks' ) ); + list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); $sql = "SELECT 'BrokenRedirects' AS type, p1.page_namespace AS namespace, diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 5d058e923d..f9fe14ef29 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -31,7 +31,7 @@ class ContribsFinder { list( $index, $usercond ) = $this->getUserCond(); $nscond = $this->getNamespaceCond(); $use_index = $this->dbr->useIndexClause( $index ); - extract( $this->dbr->tableNames( 'revision', 'page' ) ); + list( $revision, $page) = $this->dbr->tableNamesN( 'revision', 'page' ); $sql = "SELECT rev_timestamp " . " FROM $page,$revision $use_index " . " WHERE rev_page=page_id AND $usercond $nscond" . @@ -82,7 +82,7 @@ class ContribsFinder { $nscond = $this->getNamespaceCond(); $use_index = $this->dbr->useIndexClause( $index ); - extract( $this->dbr->tableNames( 'page', 'revision' ) ); + list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' ); $sql = "SELECT rev_timestamp FROM $page, $revision $use_index " . "WHERE page_id = rev_page AND rev_timestamp > '" . $this->offset . "' AND " . @@ -106,7 +106,7 @@ class ContribsFinder { function getFirstOffsetForPaging() { list( $index, $usercond ) = $this->getUserCond(); $use_index = $this->dbr->useIndexClause( $index ); - extract( $this->dbr->tableNames( 'page', 'revision' ) ); + list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' ); $nscond = $this->getNamespaceCond(); $sql = "SELECT rev_timestamp FROM $page, $revision $use_index " . "WHERE page_id = rev_page AND " . @@ -128,9 +128,9 @@ class ContribsFinder { } /* private */ function makeSql() { - $userCond = $condition = $index = $offsetQuery = ''; + $offsetQuery = ''; - extract( $this->dbr->tableNames( 'page', 'revision' ) ); + list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' ); list( $index, $userCond ) = $this->getUserCond(); if ( $this->offset ) diff --git a/includes/SpecialDeadendpages.php b/includes/SpecialDeadendpages.php index b319a17087..4ffe5e0331 100644 --- a/includes/SpecialDeadendpages.php +++ b/includes/SpecialDeadendpages.php @@ -43,7 +43,7 @@ class DeadendPagesPage extends PageQueryPage { */ function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'pagelinks' ) ); + list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); return "SELECT 'Deadendpages' as type, page_namespace AS namespace, page_title as title, page_title AS value " . "FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " . "WHERE pl_from IS NULL " . diff --git a/includes/SpecialDoubleRedirects.php b/includes/SpecialDoubleRedirects.php index fe42b00a1b..cf1153eacc 100644 --- a/includes/SpecialDoubleRedirects.php +++ b/includes/SpecialDoubleRedirects.php @@ -26,7 +26,7 @@ class DoubleRedirectsPage extends PageQueryPage { function getSQLText( &$dbr, $namespace = null, $title = null ) { - extract( $dbr->tableNames( 'page', 'pagelinks' ) ); + list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); $limitToTitle = !( $namespace === null && $title === null ); $sql = $limitToTitle ? "SELECT" : "SELECT 'DoubleRedirects' as type," ; diff --git a/includes/SpecialLonelypages.php b/includes/SpecialLonelypages.php index 150229248b..8770a9e7a0 100644 --- a/includes/SpecialLonelypages.php +++ b/includes/SpecialLonelypages.php @@ -30,7 +30,7 @@ class LonelyPagesPage extends PageQueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'pagelinks' ) ); + list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' ); return "SELECT 'Lonelypages' AS type, diff --git a/includes/SpecialMostcategories.php b/includes/SpecialMostcategories.php index c0d662cc41..06002af26a 100644 --- a/includes/SpecialMostcategories.php +++ b/includes/SpecialMostcategories.php @@ -20,7 +20,7 @@ class MostcategoriesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'categorylinks', 'page' ) ); + list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' ); return " SELECT diff --git a/includes/SpecialMostimages.php b/includes/SpecialMostimages.php index 09f7108863..17c07c70db 100644 --- a/includes/SpecialMostimages.php +++ b/includes/SpecialMostimages.php @@ -20,7 +20,7 @@ class MostimagesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'imagelinks' ) ); + $imagelinks = $dbr->tableName( 'imagelinks' ); return " SELECT diff --git a/includes/SpecialMostlinked.php b/includes/SpecialMostlinked.php index 6f5f30dbdd..4df53aec93 100644 --- a/includes/SpecialMostlinked.php +++ b/includes/SpecialMostlinked.php @@ -28,7 +28,7 @@ class MostlinkedPage extends QueryPage { */ function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'pagelinks', 'page' ) ); + list( $pagelinks, $page ) = $dbr->tableNamesN( 'pagelinks', 'page' ); return "SELECT 'Mostlinked' AS type, pl_namespace AS namespace, diff --git a/includes/SpecialMostlinkedcategories.php b/includes/SpecialMostlinkedcategories.php index 5942b3f4ea..e1f848474d 100644 --- a/includes/SpecialMostlinkedcategories.php +++ b/includes/SpecialMostlinkedcategories.php @@ -22,7 +22,7 @@ class MostlinkedCategoriesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'categorylinks', 'page' ) ); + $categorylinks = $dbr->tableName( 'categorylinks' ); $name = $dbr->addQuotes( $this->getName() ); return " diff --git a/includes/SpecialMostrevisions.php b/includes/SpecialMostrevisions.php index 676923ae79..1e3334e9b6 100644 --- a/includes/SpecialMostrevisions.php +++ b/includes/SpecialMostrevisions.php @@ -22,7 +22,7 @@ class MostrevisionsPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'revision', 'page' ) ); + list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' ); return " SELECT diff --git a/includes/SpecialNewpages.php b/includes/SpecialNewpages.php index a9a028b144..987afa3ee1 100644 --- a/includes/SpecialNewpages.php +++ b/includes/SpecialNewpages.php @@ -42,7 +42,7 @@ class NewPagesPage extends QueryPage { global $wgUser, $wgUseRCPatrol; $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0; $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) ); + list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' ); $uwhere = $this->makeUserWhere( $dbr ); @@ -172,6 +172,7 @@ function wfSpecialNewpages($par, $specialPage) { if ( is_numeric( $bit ) ) $limit = $bit; + $m = array(); if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) $limit = intval($m[1]); if ( preg_match( '/^offset=(\d+)$/', $bit, $m ) ) diff --git a/includes/SpecialRecentchanges.php b/includes/SpecialRecentchanges.php index b7ed1302fe..267d7627f7 100644 --- a/includes/SpecialRecentchanges.php +++ b/includes/SpecialRecentchanges.php @@ -108,7 +108,7 @@ function wfSpecialRecentchanges( $par, $specialPage ) { # Database connection and caching $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'recentchanges', 'watchlist' ) ); + list( $recentchanges, $watchlist ) = $dbr->tableNamesN( 'recentchanges', 'watchlist' ); $cutoff_unixtime = time() - ( $days * 86400 ); diff --git a/includes/SpecialRecentchangeslinked.php b/includes/SpecialRecentchangeslinked.php index 8dcb1dd64b..c1c02400b3 100644 --- a/includes/SpecialRecentchangeslinked.php +++ b/includes/SpecialRecentchangeslinked.php @@ -67,7 +67,8 @@ function wfSpecialRecentchangeslinked( $par = NULL ) { $cmq = 'AND rc_minor=0'; } else { $cmq = ''; } - extract( $dbr->tableNames( 'recentchanges', 'categorylinks', 'pagelinks', 'revision', 'page' , "watchlist" ) ); + list($recentchanges, $categorylinks, $pagelinks, $watchlist) = + $dbr->tableNamesN( 'recentchanges', 'categorylinks', 'pagelinks', "watchlist" ); $uid = $wgUser->getID(); diff --git a/includes/SpecialStatistics.php b/includes/SpecialStatistics.php index 66b1424039..a5a0fc3a7c 100644 --- a/includes/SpecialStatistics.php +++ b/includes/SpecialStatistics.php @@ -15,7 +15,6 @@ function wfSpecialStatistics() { $action = $wgRequest->getVal( 'action' ); $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'site_stats', 'user', 'user_groups' ) ); $views = SiteStats::views(); $edits = SiteStats::edits(); @@ -59,6 +58,7 @@ function wfSpecialStatistics() { global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang; if( !$wgDisableCounters && !$wgMiserMode ) { + $page = $dbr->tableName( 'page' ); $sql = "SELECT page_namespace, page_title, page_counter FROM {$page} WHERE page_is_redirect = 0 AND page_counter > 0 ORDER BY page_counter DESC"; $sql = $dbr->limitResult($sql, 10, 0); $res = $dbr->query( $sql, $fname ); diff --git a/includes/SpecialUncategorizedimages.php b/includes/SpecialUncategorizedimages.php index 3815697630..1daba8edcb 100644 --- a/includes/SpecialUncategorizedimages.php +++ b/includes/SpecialUncategorizedimages.php @@ -28,7 +28,7 @@ class UncategorizedImagesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'categorylinks' ) ); + list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' ); $ns = NS_IMAGE; return "SELECT 'Uncategorizedimages' AS type, page_namespace AS namespace, diff --git a/includes/SpecialUncategorizedpages.php b/includes/SpecialUncategorizedpages.php index 0ecc5d077d..dbf23a60d4 100644 --- a/includes/SpecialUncategorizedpages.php +++ b/includes/SpecialUncategorizedpages.php @@ -28,7 +28,7 @@ class UncategorizedPagesPage extends PageQueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'categorylinks' ) ); + list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' ); $name = $dbr->addQuotes( $this->getName() ); return diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 421063ef30..f3bdb6a448 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -278,12 +278,12 @@ class PageArchive { * @return int number of revisions restored */ private function undeleteRevisions( $timestamps ) { - global $wgParser, $wgDBtype; + global $wgDBtype; $restoreAll = empty( $timestamps ); $dbw =& wfGetDB( DB_MASTER ); - extract( $dbw->tableNames( 'page', 'archive' ) ); + $page = $dbw->tableName( 'archive' ); # Does this page already exist? We'll have to update it... $article = new Article( $this->title ); @@ -453,6 +453,7 @@ class UndeleteForm { $timestamps = array(); $this->mFileVersions = array(); foreach( $_REQUEST as $key => $val ) { + $matches = array(); if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) { array_push( $timestamps, $matches[1] ); } diff --git a/includes/SpecialUnusedcategories.php b/includes/SpecialUnusedcategories.php index 270180ef68..6520513ff9 100644 --- a/includes/SpecialUnusedcategories.php +++ b/includes/SpecialUnusedcategories.php @@ -23,7 +23,7 @@ class UnusedCategoriesPage extends QueryPage { function getSQL() { $NScat = NS_CATEGORY; $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'categorylinks','page' )); + list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' ); return "SELECT 'Unusedcategories' as type, {$NScat} as namespace, page_title as title, 1 as value FROM $page diff --git a/includes/SpecialUnusedimages.php b/includes/SpecialUnusedimages.php index 32a6f95a6b..75d702c852 100644 --- a/includes/SpecialUnusedimages.php +++ b/includes/SpecialUnusedimages.php @@ -25,7 +25,7 @@ class UnusedimagesPage extends QueryPage { $dbr =& wfGetDB( DB_SLAVE ); if ( $wgCountCategorizedImagesAsUsed ) { - extract( $dbr->tableNames( 'page', 'image', 'imagelinks', 'categorylinks' ) ); + list( $page, $image, $imagelinks, $categorylinks ) = $dbr->tableNamesN( 'page', 'image', 'imagelinks', 'categorylinks' ); return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description FROM ((('.$page.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.page_id = L.cl_from) @@ -33,7 +33,7 @@ class UnusedimagesPage extends QueryPage { INNER JOIN '.$image.' AS G ON I.page_title = G.img_name) WHERE I.page_namespace = '.NS_IMAGE.' AND L.cl_from IS NULL AND P.il_to IS NULL'; } else { - extract( $dbr->tableNames( 'image','imagelinks' ) ); + list( $image, $imagelinks ) = $dbr->tableNamesN( 'image','imagelinks' ); return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' . ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL '; diff --git a/includes/SpecialUnusedtemplates.php b/includes/SpecialUnusedtemplates.php index d232f02d6b..2af9abc60d 100644 --- a/includes/SpecialUnusedtemplates.php +++ b/includes/SpecialUnusedtemplates.php @@ -23,7 +23,7 @@ class UnusedtemplatesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'templatelinks' ) ); + list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' ); $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title, page_namespace AS namespace, 0 AS value FROM $page diff --git a/includes/SpecialUnwatchedpages.php b/includes/SpecialUnwatchedpages.php index 66e5c09166..f9dff724a3 100644 --- a/includes/SpecialUnwatchedpages.php +++ b/includes/SpecialUnwatchedpages.php @@ -22,7 +22,7 @@ class UnwatchedpagesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'watchlist' ) ); + list( $page, $watchlist ) = $dbr->tableNamesN( 'page', 'watchlist' ); $mwns = NS_MEDIAWIKI; return " diff --git a/includes/SpecialWantedcategories.php b/includes/SpecialWantedcategories.php index 97bb0a261b..05ee7ec027 100644 --- a/includes/SpecialWantedcategories.php +++ b/includes/SpecialWantedcategories.php @@ -22,7 +22,7 @@ class WantedCategoriesPage extends QueryPage { function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'categorylinks', 'page' ) ); + list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' ); $name = $dbr->addQuotes( $this->getName() ); return " diff --git a/includes/SpecialWatchlist.php b/includes/SpecialWatchlist.php index 760bb8db7e..0441f55faa 100644 --- a/includes/SpecialWatchlist.php +++ b/includes/SpecialWatchlist.php @@ -113,7 +113,7 @@ function wfSpecialWatchlist( $par ) { } $dbr =& wfGetDB( DB_SLAVE ); - extract( $dbr->tableNames( 'page', 'revision', 'watchlist', 'recentchanges' ) ); + list( $page, $watchlist, $recentchanges ) = $dbr->tableNamesN( 'page', 'watchlist', 'recentchanges' ); $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid"; $res = $dbr->query( $sql, $fname ); diff --git a/includes/SpecialWhatlinkshere.php b/includes/SpecialWhatlinkshere.php index 438f52e465..bed783f84a 100644 --- a/includes/SpecialWhatlinkshere.php +++ b/includes/SpecialWhatlinkshere.php @@ -76,8 +76,6 @@ class WhatLinksHerePage { $dbr =& wfGetDB( DB_READ ); - extract( $dbr->tableNames( 'pagelinks', 'templatelinks', 'page' ) ); - // Some extra validation $from = intval( $from ); if ( !$from && $dir == 'prev' ) { diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 8953d7abb8..a982439567 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -248,7 +248,6 @@ class EmailNotification { } if( $userCondition ) { $dbr =& wfGetDB( DB_MASTER ); - extract( $dbr->tableNames( 'watchlist' ) ); $res = $dbr->select( 'watchlist', array( 'wl_user' ), array( diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 4c894bca7a..f6d55bfce2 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -41,7 +41,7 @@ class ApiQueryLogEvents extends ApiQueryBase { $db = & $this->getDB(); - extract($db->tableNames('logging', 'page', 'user'), EXTR_PREFIX_ALL, 'tbl'); + list($tbl_logging, $tbl_page, $tbl_user) = $db->tableNamesN('logging', 'page', 'user'); $this->addOption('STRAIGHT_JOIN'); $this->addTables("$tbl_logging LEFT OUTER JOIN $tbl_page ON " . diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 65e57377a0..e0bb692463 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -54,8 +54,8 @@ class ApiQueryContributions extends ApiQueryBase { if (!$userid) $this->dieUsage("User name $user not found", 'param_user'); - //Extract the table names, in case we have a prefix - extract($db->tableNames( 'page', 'revision'), EXTR_PREFIX_ALL, 'tbl'); + //Get the table names + list ($tbl_page, $tbl_revision) = $db->tableNamesN('page', 'revision'); //We're after the revision table, and the corresponding page row for //anything we retrieve.