Index: trunk/phase3/includes/parser/LinkHolderArray.php |
— | — | @@ -371,11 +371,12 @@ |
372 | 372 | if(!$linkBatch->isEmpty()){ |
373 | 373 | // construct query |
374 | 374 | $dbr = wfGetDB( DB_SLAVE ); |
375 | | - $page = $dbr->tableName( 'page' ); |
376 | | - $titleClause = $linkBatch->constructSet('page', $dbr); |
377 | | - $variantQuery = "SELECT page_id, page_namespace, page_title, page_is_redirect, page_len"; |
378 | | - $variantQuery .= " FROM $page WHERE $titleClause"; |
379 | | - $varRes = $dbr->query( $variantQuery, __METHOD__ ); |
| 375 | + $varRes = $dbr->select( 'page', |
| 376 | + array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect', 'page_len' ), |
| 377 | + $linkBatch->constructSet( 'page', $dbr ), |
| 378 | + __METHOD__ |
| 379 | + ); |
| 380 | + |
380 | 381 | $linkcolour_ids = array(); |
381 | 382 | |
382 | 383 | // for each found variants, figure out link holders and replace |
— | — | @@ -386,14 +387,14 @@ |
387 | 388 | $vardbk = $variantTitle->getDBkey(); |
388 | 389 | |
389 | 390 | $holderKeys = array(); |
390 | | - if(isset($variantMap[$varPdbk])){ |
| 391 | + if( isset( $variantMap[$varPdbk] ) ) { |
391 | 392 | $holderKeys = $variantMap[$varPdbk]; |
392 | 393 | $linkCache->addGoodLinkObj( $s->page_id, $variantTitle, $s->page_len, $s->page_is_redirect ); |
393 | 394 | $output->addLink( $variantTitle, $s->page_id ); |
394 | 395 | } |
395 | 396 | |
396 | 397 | // loop over link holders |
397 | | - foreach($holderKeys as $key){ |
| 398 | + foreach( $holderKeys as $key ) { |
398 | 399 | list( $ns, $index ) = explode( ':', $key, 2 ); |
399 | 400 | $entry =& $this->internals[$ns][$index]; |
400 | 401 | $pdbk = $entry['pdbk']; |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -997,12 +997,12 @@ |
998 | 998 | |
999 | 999 | # Fetch existence plus the hiddencat property |
1000 | 1000 | $dbr = wfGetDB( DB_SLAVE ); |
1001 | | - $pageTable = $dbr->tableName( 'page' ); |
1002 | | - $where = $lb->constructSet( 'page', $dbr ); |
1003 | | - $propsTable = $dbr->tableName( 'page_props' ); |
1004 | | - $sql = "SELECT page_id, page_namespace, page_title, page_len, page_is_redirect, page_latest, pp_value |
1005 | | - FROM $pageTable LEFT JOIN $propsTable ON pp_propname='hiddencat' AND pp_page=page_id WHERE $where"; |
1006 | | - $res = $dbr->query( $sql, __METHOD__ ); |
| 1001 | + $res = $dbr->select( array( 'page', 'page_props' ), |
| 1002 | + array( 'page_id', 'page_namespace', 'page_title', 'page_len', 'page_is_redirect', 'page_latest', 'pp_value' ), |
| 1003 | + $lb->constructSet( 'page', $dbr ), |
| 1004 | + __METHOD__, |
| 1005 | + array( 'LEFT JOIN' => array( "pp_propname='hiddencat'", "pp_page=page_id" ) ) |
| 1006 | + ); |
1007 | 1007 | |
1008 | 1008 | # Add the results to the link cache |
1009 | 1009 | $lb->addResultToCache( LinkCache::singleton(), $res ); |