r17952 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17951‎ | r17952 | r17953 >
Date:08:36, 27 November 2006
Author:nickj
Status:old
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/Image.php (modified) (history)
  • /trunk/phase3/includes/SiteStats.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)
  • /trunk/phase3/includes/SpecialBrokenRedirects.php (modified) (history)
  • /trunk/phase3/includes/SpecialContributions.php (modified) (history)
  • /trunk/phase3/includes/SpecialDeadendpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialDoubleRedirects.php (modified) (history)
  • /trunk/phase3/includes/SpecialLonelypages.php (modified) (history)
  • /trunk/phase3/includes/SpecialMostcategories.php (modified) (history)
  • /trunk/phase3/includes/SpecialMostimages.php (modified) (history)
  • /trunk/phase3/includes/SpecialMostlinked.php (modified) (history)
  • /trunk/phase3/includes/SpecialMostlinkedcategories.php (modified) (history)
  • /trunk/phase3/includes/SpecialMostrevisions.php (modified) (history)
  • /trunk/phase3/includes/SpecialNewpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchanges.php (modified) (history)
  • /trunk/phase3/includes/SpecialRecentchangeslinked.php (modified) (history)
  • /trunk/phase3/includes/SpecialStatistics.php (modified) (history)
  • /trunk/phase3/includes/SpecialUncategorizedimages.php (modified) (history)
  • /trunk/phase3/includes/SpecialUncategorizedpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialUndelete.php (modified) (history)
  • /trunk/phase3/includes/SpecialUnusedcategories.php (modified) (history)
  • /trunk/phase3/includes/SpecialUnusedimages.php (modified) (history)
  • /trunk/phase3/includes/SpecialUnusedtemplates.php (modified) (history)
  • /trunk/phase3/includes/SpecialUnwatchedpages.php (modified) (history)
  • /trunk/phase3/includes/SpecialWantedcategories.php (modified) (history)
  • /trunk/phase3/includes/SpecialWatchlist.php (modified) (history)
  • /trunk/phase3/includes/SpecialWhatlinkshere.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryLogEvents.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialUnwatchedpages.php
@@ -22,7 +22,7 @@
2323
2424 function getSQL() {
2525 $dbr =& wfGetDB( DB_SLAVE );
26 - extract( $dbr->tableNames( 'page', 'watchlist' ) );
 26+ list( $page, $watchlist ) = $dbr->tableNamesN( 'page', 'watchlist' );
2727 $mwns = NS_MEDIAWIKI;
2828 return
2929 "
Index: trunk/phase3/includes/Block.php
@@ -308,7 +308,7 @@
309309
310310 $now = wfTimestampNow();
311311
312 - extract( $db->tableNames( 'ipblocks', 'user' ) );
 312+ list( $ipblocks, $user ) = $db->tableNamesN( 'ipblocks', 'user' );
313313
314314 $sql = "SELECT $ipblocks.*,user_name FROM $ipblocks,$user " .
315315 "WHERE user_id=ipb_by $cond ORDER BY ipb_timestamp DESC $options";
Index: trunk/phase3/includes/Skin.php
@@ -1034,7 +1034,7 @@
10351035
10361036 if ($wgPageShowWatchingUsers && $wgUser->getOption( 'shownumberswatching' )) {
10371037 $dbr =& wfGetDB( DB_SLAVE );
1038 - extract( $dbr->tableNames( 'watchlist' ) );
 1038+ $watchlist = $dbr->tableName( 'watchlist' );
10391039 $sql = "SELECT COUNT(*) AS n FROM $watchlist
10401040 WHERE wl_title='" . $dbr->strencode($wgTitle->getDBKey()) .
10411041 "' AND wl_namespace=" . $wgTitle->getNamespace() ;
Index: trunk/phase3/includes/SpecialUnusedtemplates.php
@@ -23,7 +23,7 @@
2424
2525 function getSQL() {
2626 $dbr =& wfGetDB( DB_SLAVE );
27 - extract( $dbr->tableNames( 'page', 'templatelinks' ) );
 27+ list( $page, $templatelinks) = $dbr->tableNamesN( 'page', 'templatelinks' );
2828 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title,
2929 page_namespace AS namespace, 0 AS value
3030 FROM $page
Index: trunk/phase3/includes/SpecialWantedcategories.php
@@ -22,7 +22,7 @@
2323
2424 function getSQL() {
2525 $dbr =& wfGetDB( DB_SLAVE );
26 - extract( $dbr->tableNames( 'categorylinks', 'page' ) );
 26+ list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
2727 $name = $dbr->addQuotes( $this->getName() );
2828 return
2929 "
Index: trunk/phase3/includes/SpecialUnusedimages.php
@@ -25,7 +25,7 @@
2626 $dbr =& wfGetDB( DB_SLAVE );
2727
2828 if ( $wgCountCategorizedImagesAsUsed ) {
29 - extract( $dbr->tableNames( 'page', 'image', 'imagelinks', 'categorylinks' ) );
 29+ list( $page, $image, $imagelinks, $categorylinks ) = $dbr->tableNamesN( 'page', 'image', 'imagelinks', 'categorylinks' );
3030
3131 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description
3232 FROM ((('.$page.' AS I LEFT JOIN '.$categorylinks.' AS L ON I.page_id = L.cl_from)
@@ -33,7 +33,7 @@
3434 INNER JOIN '.$image.' AS G ON I.page_title = G.img_name)
3535 WHERE I.page_namespace = '.NS_IMAGE.' AND L.cl_from IS NULL AND P.il_to IS NULL';
3636 } else {
37 - extract( $dbr->tableNames( 'image','imagelinks' ) );
 37+ list( $image, $imagelinks ) = $dbr->tableNamesN( 'image','imagelinks' );
3838
3939 return 'SELECT img_name as title, img_user, img_user_text, img_timestamp as value, img_description' .
4040 ' FROM '.$image.' LEFT JOIN '.$imagelinks.' ON img_name=il_to WHERE il_to IS NULL ';
Index: trunk/phase3/includes/Database.php
@@ -1383,7 +1383,7 @@
13841384 * $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user
13851385 * WHERE wl_user=user_id AND wl_user=$nameWithQuotes";
13861386 */
1387 - function tableNames() {
 1387+ public function tableNames() {
13881388 $inArray = func_get_args();
13891389 $retVal = array();
13901390 foreach ( $inArray as $name ) {
@@ -1391,6 +1391,24 @@
13921392 }
13931393 return $retVal;
13941394 }
 1395+
 1396+ /**
 1397+ * @desc: Fetch a number of table names into an zero-indexed numerical array
 1398+ * This is handy when you need to construct SQL for joins
 1399+ *
 1400+ * Example:
 1401+ * list( $user, $watchlist ) = $dbr->tableNames('user','watchlist');
 1402+ * $sql = "SELECT wl_namespace,wl_title FROM $watchlist,$user
 1403+ * WHERE wl_user=user_id AND wl_user=$nameWithQuotes";
 1404+ */
 1405+ public function tableNamesN() {
 1406+ $inArray = func_get_args();
 1407+ $retVal = array();
 1408+ foreach ( $inArray as $name ) {
 1409+ $retVal[] = $this->tableName( $name );
 1410+ }
 1411+ return $retVal;
 1412+ }
13951413
13961414 /**
13971415 * @private
Index: trunk/phase3/includes/SpecialDeadendpages.php
@@ -43,7 +43,7 @@
4444 */
4545 function getSQL() {
4646 $dbr =& wfGetDB( DB_SLAVE );
47 - extract( $dbr->tableNames( 'page', 'pagelinks' ) );
 47+ list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
4848 return "SELECT 'Deadendpages' as type, page_namespace AS namespace, page_title as title, page_title AS value " .
4949 "FROM $page LEFT JOIN $pagelinks ON page_id = pl_from " .
5050 "WHERE pl_from IS NULL " .
Index: trunk/phase3/includes/SpecialRecentchangeslinked.php
@@ -67,7 +67,8 @@
6868 $cmq = 'AND rc_minor=0';
6969 } else { $cmq = ''; }
7070
71 - extract( $dbr->tableNames( 'recentchanges', 'categorylinks', 'pagelinks', 'revision', 'page' , "watchlist" ) );
 71+ list($recentchanges, $categorylinks, $pagelinks, $watchlist) =
 72+ $dbr->tableNamesN( 'recentchanges', 'categorylinks', 'pagelinks', "watchlist" );
7273
7374 $uid = $wgUser->getID();
7475
Index: trunk/phase3/includes/SiteStats.php
@@ -127,7 +127,7 @@
128128 # Update schema if required
129129 if ( $row->ss_total_pages == -1 && !$this->mViews ) {
130130 $dbr =& wfGetDB( DB_SLAVE, array( 'SpecialStatistics', 'vslow') );
131 - extract( $dbr->tableNames( 'page', 'user' ) );
 131+ list( $page, $user ) = $dbr->tableNamesN( 'page', 'user' );
132132
133133 $sql = "SELECT COUNT(page_namespace) AS total FROM $page";
134134 $res = $dbr->query( $sql, $fname );
Index: trunk/phase3/includes/SpecialMostrevisions.php
@@ -22,7 +22,7 @@
2323
2424 function getSQL() {
2525 $dbr =& wfGetDB( DB_SLAVE );
26 - extract( $dbr->tableNames( 'revision', 'page' ) );
 26+ list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
2727 return
2828 "
2929 SELECT
Index: trunk/phase3/includes/SpecialMostcategories.php
@@ -20,7 +20,7 @@
2121
2222 function getSQL() {
2323 $dbr =& wfGetDB( DB_SLAVE );
24 - extract( $dbr->tableNames( 'categorylinks', 'page' ) );
 24+ list( $categorylinks, $page) = $dbr->tableNamesN( 'categorylinks', 'page' );
2525 return
2626 "
2727 SELECT
Index: trunk/phase3/includes/SpecialMostimages.php
@@ -20,7 +20,7 @@
2121
2222 function getSQL() {
2323 $dbr =& wfGetDB( DB_SLAVE );
24 - extract( $dbr->tableNames( 'imagelinks' ) );
 24+ $imagelinks = $dbr->tableName( 'imagelinks' );
2525 return
2626 "
2727 SELECT
Index: trunk/phase3/includes/SpecialWhatlinkshere.php
@@ -76,8 +76,6 @@
7777
7878 $dbr =& wfGetDB( DB_READ );
7979
80 - extract( $dbr->tableNames( 'pagelinks', 'templatelinks', 'page' ) );
81 -
8280 // Some extra validation
8381 $from = intval( $from );
8482 if ( !$from && $dir == 'prev' ) {
Index: trunk/phase3/includes/SpecialRecentchanges.php
@@ -108,7 +108,7 @@
109109
110110 # Database connection and caching
111111 $dbr =& wfGetDB( DB_SLAVE );
112 - extract( $dbr->tableNames( 'recentchanges', 'watchlist' ) );
 112+ list( $recentchanges, $watchlist ) = $dbr->tableNamesN( 'recentchanges', 'watchlist' );
113113
114114
115115 $cutoff_unixtime = time() - ( $days * 86400 );
Index: trunk/phase3/includes/SpecialLonelypages.php
@@ -30,7 +30,7 @@
3131
3232 function getSQL() {
3333 $dbr =& wfGetDB( DB_SLAVE );
34 - extract( $dbr->tableNames( 'page', 'pagelinks' ) );
 34+ list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
3535
3636 return
3737 "SELECT 'Lonelypages' AS type,
Index: trunk/phase3/includes/SpecialUncategorizedpages.php
@@ -28,7 +28,7 @@
2929
3030 function getSQL() {
3131 $dbr =& wfGetDB( DB_SLAVE );
32 - extract( $dbr->tableNames( 'page', 'categorylinks' ) );
 32+ list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
3333 $name = $dbr->addQuotes( $this->getName() );
3434
3535 return
Index: trunk/phase3/includes/SpecialContributions.php
@@ -31,7 +31,7 @@
3232 list( $index, $usercond ) = $this->getUserCond();
3333 $nscond = $this->getNamespaceCond();
3434 $use_index = $this->dbr->useIndexClause( $index );
35 - extract( $this->dbr->tableNames( 'revision', 'page' ) );
 35+ list( $revision, $page) = $this->dbr->tableNamesN( 'revision', 'page' );
3636 $sql = "SELECT rev_timestamp " .
3737 " FROM $page,$revision $use_index " .
3838 " WHERE rev_page=page_id AND $usercond $nscond" .
@@ -82,7 +82,7 @@
8383 $nscond = $this->getNamespaceCond();
8484
8585 $use_index = $this->dbr->useIndexClause( $index );
86 - extract( $this->dbr->tableNames( 'page', 'revision' ) );
 86+ list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' );
8787
8888 $sql = "SELECT rev_timestamp FROM $page, $revision $use_index " .
8989 "WHERE page_id = rev_page AND rev_timestamp > '" . $this->offset . "' AND " .
@@ -106,7 +106,7 @@
107107 function getFirstOffsetForPaging() {
108108 list( $index, $usercond ) = $this->getUserCond();
109109 $use_index = $this->dbr->useIndexClause( $index );
110 - extract( $this->dbr->tableNames( 'page', 'revision' ) );
 110+ list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' );
111111 $nscond = $this->getNamespaceCond();
112112 $sql = "SELECT rev_timestamp FROM $page, $revision $use_index " .
113113 "WHERE page_id = rev_page AND " .
@@ -128,9 +128,9 @@
129129 }
130130
131131 /* private */ function makeSql() {
132 - $userCond = $condition = $index = $offsetQuery = '';
 132+ $offsetQuery = '';
133133
134 - extract( $this->dbr->tableNames( 'page', 'revision' ) );
 134+ list( $page, $revision ) = $this->dbr->tableNamesN( 'page', 'revision' );
135135 list( $index, $userCond ) = $this->getUserCond();
136136
137137 if ( $this->offset )
Index: trunk/phase3/includes/UserMailer.php
@@ -248,7 +248,6 @@
249249 }
250250 if( $userCondition ) {
251251 $dbr =& wfGetDB( DB_MASTER );
252 - extract( $dbr->tableNames( 'watchlist' ) );
253252
254253 $res = $dbr->select( 'watchlist', array( 'wl_user' ),
255254 array(
Index: trunk/phase3/includes/SpecialUnusedcategories.php
@@ -23,7 +23,7 @@
2424 function getSQL() {
2525 $NScat = NS_CATEGORY;
2626 $dbr =& wfGetDB( DB_SLAVE );
27 - extract( $dbr->tableNames( 'categorylinks','page' ));
 27+ list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
2828 return "SELECT 'Unusedcategories' as type,
2929 {$NScat} as namespace, page_title as title, 1 as value
3030 FROM $page
Index: trunk/phase3/includes/SpecialUncategorizedimages.php
@@ -28,7 +28,7 @@
2929
3030 function getSQL() {
3131 $dbr =& wfGetDB( DB_SLAVE );
32 - extract( $dbr->tableNames( 'page', 'categorylinks' ) );
 32+ list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
3333 $ns = NS_IMAGE;
3434
3535 return "SELECT 'Uncategorizedimages' AS type, page_namespace AS namespace,
Index: trunk/phase3/includes/SpecialWatchlist.php
@@ -113,7 +113,7 @@
114114 }
115115
116116 $dbr =& wfGetDB( DB_SLAVE );
117 - extract( $dbr->tableNames( 'page', 'revision', 'watchlist', 'recentchanges' ) );
 117+ list( $page, $watchlist, $recentchanges ) = $dbr->tableNamesN( 'page', 'watchlist', 'recentchanges' );
118118
119119 $sql = "SELECT COUNT(*) AS n FROM $watchlist WHERE wl_user=$uid";
120120 $res = $dbr->query( $sql, $fname );
Index: trunk/phase3/includes/SpecialMostlinked.php
@@ -28,7 +28,7 @@
2929 */
3030 function getSQL() {
3131 $dbr =& wfGetDB( DB_SLAVE );
32 - extract( $dbr->tableNames( 'pagelinks', 'page' ) );
 32+ list( $pagelinks, $page ) = $dbr->tableNamesN( 'pagelinks', 'page' );
3333 return
3434 "SELECT 'Mostlinked' AS type,
3535 pl_namespace AS namespace,
Index: trunk/phase3/includes/SpecialDoubleRedirects.php
@@ -26,7 +26,7 @@
2727
2828 function getSQLText( &$dbr, $namespace = null, $title = null ) {
2929
30 - extract( $dbr->tableNames( 'page', 'pagelinks' ) );
 30+ list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
3131
3232 $limitToTitle = !( $namespace === null && $title === null );
3333 $sql = $limitToTitle ? "SELECT" : "SELECT 'DoubleRedirects' as type," ;
Index: trunk/phase3/includes/SpecialMostlinkedcategories.php
@@ -22,7 +22,7 @@
2323
2424 function getSQL() {
2525 $dbr =& wfGetDB( DB_SLAVE );
26 - extract( $dbr->tableNames( 'categorylinks', 'page' ) );
 26+ $categorylinks = $dbr->tableName( 'categorylinks' );
2727 $name = $dbr->addQuotes( $this->getName() );
2828 return
2929 "
Index: trunk/phase3/includes/api/ApiQueryLogEvents.php
@@ -41,7 +41,7 @@
4242
4343 $db = & $this->getDB();
4444
45 - extract($db->tableNames('logging', 'page', 'user'), EXTR_PREFIX_ALL, 'tbl');
 45+ list($tbl_logging, $tbl_page, $tbl_user) = $db->tableNamesN('logging', 'page', 'user');
4646
4747 $this->addOption('STRAIGHT_JOIN');
4848 $this->addTables("$tbl_logging LEFT OUTER JOIN $tbl_page ON " .
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -54,8 +54,8 @@
5555 if (!$userid)
5656 $this->dieUsage("User name $user not found", 'param_user');
5757
58 - //Extract the table names, in case we have a prefix
59 - extract($db->tableNames( 'page', 'revision'), EXTR_PREFIX_ALL, 'tbl');
 58+ //Get the table names
 59+ list ($tbl_page, $tbl_revision) = $db->tableNamesN('page', 'revision');
6060
6161 //We're after the revision table, and the corresponding page row for
6262 //anything we retrieve.
Index: trunk/phase3/includes/SpecialUndelete.php
@@ -278,12 +278,12 @@
279279 * @return int number of revisions restored
280280 */
281281 private function undeleteRevisions( $timestamps ) {
282 - global $wgParser, $wgDBtype;
 282+ global $wgDBtype;
283283
284284 $restoreAll = empty( $timestamps );
285285
286286 $dbw =& wfGetDB( DB_MASTER );
287 - extract( $dbw->tableNames( 'page', 'archive' ) );
 287+ $page = $dbw->tableName( 'archive' );
288288
289289 # Does this page already exist? We'll have to update it...
290290 $article = new Article( $this->title );
@@ -453,6 +453,7 @@
454454 $timestamps = array();
455455 $this->mFileVersions = array();
456456 foreach( $_REQUEST as $key => $val ) {
 457+ $matches = array();
457458 if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
458459 array_push( $timestamps, $matches[1] );
459460 }
Index: trunk/phase3/includes/SpecialNewpages.php
@@ -42,7 +42,7 @@
4343 global $wgUser, $wgUseRCPatrol;
4444 $usepatrol = ( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) ) ? 1 : 0;
4545 $dbr =& wfGetDB( DB_SLAVE );
46 - extract( $dbr->tableNames( 'recentchanges', 'page', 'text' ) );
 46+ list( $recentchanges, $page ) = $dbr->tableNamesN( 'recentchanges', 'page' );
4747
4848 $uwhere = $this->makeUserWhere( $dbr );
4949
@@ -172,6 +172,7 @@
173173 if ( is_numeric( $bit ) )
174174 $limit = $bit;
175175
 176+ $m = array();
176177 if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) )
177178 $limit = intval($m[1]);
178179 if ( preg_match( '/^offset=(\d+)$/', $bit, $m ) )
Index: trunk/phase3/includes/Image.php
@@ -1702,7 +1702,7 @@
17031703 }
17041704 $linkCache =& LinkCache::singleton();
17051705
1706 - extract( $db->tableNames( 'page', 'imagelinks' ) );
 1706+ list( $page, $imagelinks ) = $db->tableNamesN( 'page', 'imagelinks' );
17071707 $encName = $db->addQuotes( $this->name );
17081708 $sql = "SELECT page_namespace,page_title,page_id FROM $page,$imagelinks WHERE page_id=il_from AND il_to=$encName $options";
17091709 $res = $db->query( $sql, __METHOD__ );
Index: trunk/phase3/includes/SpecialBrokenRedirects.php
@@ -27,7 +27,7 @@
2828
2929 function getSQL() {
3030 $dbr =& wfGetDB( DB_SLAVE );
31 - extract( $dbr->tableNames( 'page', 'pagelinks' ) );
 31+ list( $page, $pagelinks ) = $dbr->tableNamesN( 'page', 'pagelinks' );
3232
3333 $sql = "SELECT 'BrokenRedirects' AS type,
3434 p1.page_namespace AS namespace,
Index: trunk/phase3/includes/SpecialStatistics.php
@@ -15,7 +15,6 @@
1616 $action = $wgRequest->getVal( 'action' );
1717
1818 $dbr =& wfGetDB( DB_SLAVE );
19 - extract( $dbr->tableNames( 'site_stats', 'user', 'user_groups' ) );
2019
2120 $views = SiteStats::views();
2221 $edits = SiteStats::edits();
@@ -59,6 +58,7 @@
6059
6160 global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
6261 if( !$wgDisableCounters && !$wgMiserMode ) {
 62+ $page = $dbr->tableName( 'page' );
6363 $sql = "SELECT page_namespace, page_title, page_counter FROM {$page} WHERE page_is_redirect = 0 AND page_counter > 0 ORDER BY page_counter DESC";
6464 $sql = $dbr->limitResult($sql, 10, 0);
6565 $res = $dbr->query( $sql, $fname );
Index: trunk/phase3/includes/SkinTemplate.php
@@ -54,6 +54,7 @@
5555
5656 $value = wfMsg( $value );
5757 // interpolate variables
 58+ $m = array();
5859 while (preg_match('/\$([0-9]*?)/sm', $value, $m)) {
5960 list($src, $var) = $m;
6061 wfSuppressWarnings();
@@ -344,7 +345,7 @@
345346
346347 if ($wgPageShowWatchingUsers) {
347348 $dbr =& wfGetDB( DB_SLAVE );
348 - extract( $dbr->tableNames( 'watchlist' ) );
 349+ $watchlist = $dbr->tableName( 'watchlist' );
349350 $sql = "SELECT COUNT(*) AS n FROM $watchlist
350351 WHERE wl_title='" . $dbr->strencode($this->mTitle->getDBKey()) .
351352 "' AND wl_namespace=" . $this->mTitle->getNamespace() ;