Index: trunk/phase3/includes/Title.php |
— | — | @@ -2443,42 +2443,35 @@ |
2444 | 2444 | * Get an array of Title objects referring to non-existent articles linked from this page |
2445 | 2445 | * |
2446 | 2446 | * @todo check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case) |
2447 | | - * @param array $options may be FOR UPDATE |
2448 | 2447 | * @return \type{\arrayof{Title}} the Title objects |
2449 | 2448 | */ |
2450 | | - public function getBrokenLinksFrom( $options = array() ) { |
| 2449 | + public function getBrokenLinksFrom() { |
2451 | 2450 | if ( $this->getArticleId() == 0 ) { |
2452 | 2451 | # All links from article ID 0 are false positives |
2453 | 2452 | return array(); |
2454 | 2453 | } |
2455 | 2454 | |
2456 | | - if ( count( $options ) > 0 ) { |
2457 | | - $db = wfGetDB( DB_MASTER ); |
2458 | | - } else { |
2459 | | - $db = wfGetDB( DB_SLAVE ); |
2460 | | - } |
| 2455 | + $dbr = wfGetDB( DB_SLAVE ); |
| 2456 | + $res = $dbr->select( |
| 2457 | + array( 'page', 'pagelinks' ), |
| 2458 | + array( 'pl_namespace', 'pl_title' ), |
| 2459 | + array( |
| 2460 | + 'pl_from' => $this->getArticleId(), |
| 2461 | + 'page_namespace IS NULL' |
| 2462 | + ), |
| 2463 | + __METHOD__, array(), |
| 2464 | + array( |
| 2465 | + 'page' => array( |
| 2466 | + 'LEFT JOIN', |
| 2467 | + array( 'pl_namespace=page_namespace', 'pl_title=page_title' ) |
| 2468 | + ) |
| 2469 | + ) |
| 2470 | + ); |
2461 | 2471 | |
2462 | | - $res = $db->safeQuery( |
2463 | | - "SELECT pl_namespace, pl_title |
2464 | | - FROM ! |
2465 | | - LEFT JOIN ! |
2466 | | - ON pl_namespace=page_namespace |
2467 | | - AND pl_title=page_title |
2468 | | - WHERE pl_from=? |
2469 | | - AND page_namespace IS NULL |
2470 | | - !", |
2471 | | - $db->tableName( 'pagelinks' ), |
2472 | | - $db->tableName( 'page' ), |
2473 | | - $this->getArticleId(), |
2474 | | - $options ); |
2475 | | - |
2476 | 2472 | $retVal = array(); |
2477 | | - if ( $db->numRows( $res ) ) { |
2478 | | - foreach( $res as $row ) { |
2479 | | - $retVal[] = Title::makeTitle( $row->pl_namespace, $row->pl_title ); |
2480 | | - } |
| 2473 | + foreach( $res as $row ) { |
| 2474 | + $retVal[] = Title::makeTitle( $row->pl_namespace, $row->pl_title ); |
2481 | 2475 | } |
2482 | | - $db->freeResult( $res ); |
2483 | 2476 | return $retVal; |
2484 | 2477 | } |
2485 | 2478 | |