Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -865,22 +865,23 @@ |
866 | 866 | * |
867 | 867 | * @deprecated Use HTMLCacheUpdate, this function uses too much memory |
868 | 868 | */ |
869 | | - function getLinksTo( $options = '' ) { |
| 869 | + function getLinksTo( $options = array() ) { |
870 | 870 | wfProfileIn( __METHOD__ ); |
871 | 871 | |
872 | 872 | // Note: use local DB not repo DB, we want to know local links |
873 | | - if ( $options ) { |
| 873 | + if ( count( $options ) > 0 ) { |
874 | 874 | $db = wfGetDB( DB_MASTER ); |
875 | 875 | } else { |
876 | 876 | $db = wfGetDB( DB_SLAVE ); |
877 | 877 | } |
878 | 878 | $linkCache = LinkCache::singleton(); |
879 | 879 | |
880 | | - list( $page, $imagelinks ) = $db->tableNamesN( 'page', 'imagelinks' ); |
881 | 880 | $encName = $db->addQuotes( $this->getName() ); |
882 | | - $sql = "SELECT page_namespace,page_title,page_id,page_len,page_is_redirect, |
883 | | - FROM $page,$imagelinks WHERE page_id=il_from AND il_to=$encName $options"; |
884 | | - $res = $db->query( $sql, __METHOD__ ); |
| 881 | + $res = $db->select( array( 'page', 'imagelinks'), |
| 882 | + array( 'page_namespace', 'page_title', 'page_id', 'page_len', 'page_is_redirect' ), |
| 883 | + array( 'page_id' => 'il_from', 'il_to' => $encName ), |
| 884 | + __METHOD__, |
| 885 | + $options ); |
885 | 886 | |
886 | 887 | $retVal = array(); |
887 | 888 | if ( $db->numRows( $res ) ) { |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -2418,13 +2418,13 @@ |
2419 | 2419 | * WARNING: do not use this function on arbitrary user-supplied titles! |
2420 | 2420 | * On heavily-used templates it will max out the memory. |
2421 | 2421 | * |
2422 | | - * @param $options \type{\string} may be FOR UPDATE |
| 2422 | + * @param array $options may be FOR UPDATE |
2423 | 2423 | * @return \type{\arrayof{Title}} the Title objects linking here |
2424 | 2424 | */ |
2425 | | - public function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) { |
| 2425 | + public function getLinksTo( $options = array(), $table = 'pagelinks', $prefix = 'pl' ) { |
2426 | 2426 | $linkCache = LinkCache::singleton(); |
2427 | 2427 | |
2428 | | - if ( $options ) { |
| 2428 | + if ( count( $options ) > 0 ) { |
2429 | 2429 | $db = wfGetDB( DB_MASTER ); |
2430 | 2430 | } else { |
2431 | 2431 | $db = wfGetDB( DB_SLAVE ); |
— | — | @@ -2459,10 +2459,10 @@ |
2460 | 2460 | * WARNING: do not use this function on arbitrary user-supplied titles! |
2461 | 2461 | * On heavily-used templates it will max out the memory. |
2462 | 2462 | * |
2463 | | - * @param $options \type{\string} may be FOR UPDATE |
| 2463 | + * @param array $options may be FOR UPDATE |
2464 | 2464 | * @return \type{\arrayof{Title}} the Title objects linking here |
2465 | 2465 | */ |
2466 | | - public function getTemplateLinksTo( $options = '' ) { |
| 2466 | + public function getTemplateLinksTo( $options = array() ) { |
2467 | 2467 | return $this->getLinksTo( $options, 'templatelinks', 'tl' ); |
2468 | 2468 | } |
2469 | 2469 | |
— | — | @@ -2470,16 +2470,16 @@ |
2471 | 2471 | * Get an array of Title objects referring to non-existent articles linked from this page |
2472 | 2472 | * |
2473 | 2473 | * @todo check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case) |
2474 | | - * @param $options \type{\string} may be FOR UPDATE |
| 2474 | + * @param array $options may be FOR UPDATE |
2475 | 2475 | * @return \type{\arrayof{Title}} the Title objects |
2476 | 2476 | */ |
2477 | | - public function getBrokenLinksFrom( $options = '' ) { |
| 2477 | + public function getBrokenLinksFrom( $options = array() ) { |
2478 | 2478 | if ( $this->getArticleId() == 0 ) { |
2479 | 2479 | # All links from article ID 0 are false positives |
2480 | 2480 | return array(); |
2481 | 2481 | } |
2482 | 2482 | |
2483 | | - if ( $options ) { |
| 2483 | + if ( count( $options ) > 0 ) { |
2484 | 2484 | $db = wfGetDB( DB_MASTER ); |
2485 | 2485 | } else { |
2486 | 2486 | $db = wfGetDB( DB_SLAVE ); |
— | — | @@ -3067,7 +3067,7 @@ |
3068 | 3068 | array( 'page_is_redirect', 'page_latest', 'page_id' ), |
3069 | 3069 | $this->pageCond(), |
3070 | 3070 | __METHOD__, |
3071 | | - 'FOR UPDATE' |
| 3071 | + array( 'FOR UPDATE' ) |
3072 | 3072 | ); |
3073 | 3073 | # Cache some fields we may want |
3074 | 3074 | $this->mArticleID = $row ? intval($row->page_id) : 0; |
— | — | @@ -3085,7 +3085,7 @@ |
3086 | 3086 | 'page_latest != rev_id' |
3087 | 3087 | ), |
3088 | 3088 | __METHOD__, |
3089 | | - 'FOR UPDATE' |
| 3089 | + array( 'FOR UPDATE' ) |
3090 | 3090 | ); |
3091 | 3091 | # Return true if there was no history |
3092 | 3092 | return ($row === false); |