r79322 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79321‎ | r79322 | r79323 >
Date:04:28, 31 December 2010
Author:reedy
Status:ok
Tags:
Comment:
Followup r73745, don't manually quote, use 'blah' => $blah

And don't manually do IN
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage_body.php
@@ -1369,13 +1369,10 @@
13701370 return;
13711371 }
13721372
1373 - $catlinks = $dbr->tableName( 'categorylinks' );
1374 - $page = $dbr->tableName( 'page' );
1375 - $pagelist = "'" . implode( "', '", $pages ) . "'";
13761373 $res = $dbr->select(
13771374 array( 'page' ),
13781375 array( 'COUNT(page_id) AS count'),
1379 - array( "page_namespace=$page_ns_index", "page_title IN ( $pagelist )" ),
 1376+ array( 'page_namespace' => $page_ns_index, 'page_title' => $pages ),
13801377 __METHOD__
13811378 );
13821379 if( $res && $dbr->numRows( $res ) > 0 ) {
@@ -1386,8 +1383,13 @@
13871384 return;
13881385 }
13891386
 1387+ $pagelist = "'".implode( "', '", $pages)."'";
 1388+ $catlinks = $dbr->tableName( 'categorylinks' );
 1389+ $page = $dbr->tableName( 'page' );
 1390+
13901391 // proofreading status of pages
13911392 $query = "SELECT COUNT(page_id) AS count FROM $page LEFT JOIN $catlinks ON cl_from=page_id WHERE cl_to='###' AND page_namespace=$page_ns_index AND page_title IN ( $pagelist )" ;
 1393+
13921394 $n0 = $this->query_count( $dbr, $query, 'proofreadpage_quality0_category' );
13931395 $n2 = $this->query_count( $dbr, $query, 'proofreadpage_quality2_category' );
13941396 $n3 = $this->query_count( $dbr, $query, 'proofreadpage_quality3_category' );
@@ -1431,7 +1433,7 @@
14321434 $res = $dbr->select(
14331435 array( 'templatelinks' ),
14341436 array( 'tl_title AS title' ),
1435 - array( "tl_from=$id", "tl_namespace=$page_ns_index" ),
 1437+ array( 'tl_from' => $id, 'tl_namespace' => $page_ns_index ),
14361438 __METHOD__,
14371439 array( 'LIMIT' => 1 )
14381440 );
@@ -1443,9 +1445,9 @@
14441446 array( 'pagelinks', 'page' ),
14451447 array( 'page_title AS title' ),
14461448 array(
1447 - "pl_title='$title'",
1448 - "pl_namespace=$page_ns_index",
1449 - "page_namespace=$index_ns_index"
 1449+ 'pl_title' => $title,
 1450+ 'pl_namespace' => $page_ns_index,
 1451+ 'page_namespace' => $index_ns_index
14501452 ),
14511453 __METHOD__,
14521454 array( 'LIMIT' => 1 ),
@@ -1463,7 +1465,7 @@
14641466 $res = $dbr->select(
14651467 array( 'pr_index', 'page' ),
14661468 array( 'pr_count', 'pr_q0', 'pr_q1', 'pr_q2', 'pr_q3', 'pr_q4' ),
1467 - array( "page_title='$indextitle'", "page_namespace=$index_ns_index" ),
 1469+ array( 'page_title' => $indextitle, 'page_namespace' => $index_ns_index ),
14681470 __METHOD__,
14691471 null,
14701472 array( 'page' => array( 'LEFT JOIN', 'page_id=pr_page_id' ) )
@@ -1484,7 +1486,7 @@
14851487 $res = $dbr->select(
14861488 array( 'templatelinks', 'page' ),
14871489 array( 'COUNT(page_id) AS count' ),
1488 - array( "tl_from=$id", "tl_namespace=$page_ns_index" ),
 1490+ array( 'tl_from' => $id, 'tl_namespace' => $page_ns_index ),
14891491 __METHOD__,
14901492 null,
14911493 array( 'page' => array( 'LEFT JOIN', 'page_title=tl_title AND page_namespace=tl_namespace' ) )

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73745replace queries with select wrapperthomasv15:51, 25 September 2010

Status & tagging log