X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecialpage%2FWantedQueryPage.php;h=c4140de1d88f615e4eb12dc4844136cd0317aefc;hb=d69ffc8d6e7008851a1ea9f1c7201efbb94ef6fe;hp=678c803d19504eb6661d9f453dbe012967c4ed14;hpb=c4b064f83415ab5b4a5f9aedad20ffd16e599253;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specialpage/WantedQueryPage.php b/includes/specialpage/WantedQueryPage.php index 678c803d19..c4140de1d8 100644 --- a/includes/specialpage/WantedQueryPage.php +++ b/includes/specialpage/WantedQueryPage.php @@ -37,7 +37,7 @@ abstract class WantedQueryPage extends QueryPage { /** * Cache page existence for performance - * @param DatabaseBase $db + * @param IDatabase $db * @param ResultWrapper $res */ function preprocessResults( $db, $res ) { @@ -78,15 +78,9 @@ abstract class WantedQueryPage extends QueryPage { $title = Title::makeTitleSafe( $result->namespace, $result->title ); if ( $title instanceof Title ) { if ( $this->isCached() || $this->forceExistenceCheck() ) { - $pageLink = $title->isKnown() + $pageLink = $this->existenceCheck( $title ) ? '' . Linker::link( $title ) . '' - : Linker::link( - $title, - null, - array(), - array(), - array( 'broken' ) - ); + : Linker::link( $title ); } else { $pageLink = Linker::link( $title, @@ -102,6 +96,25 @@ abstract class WantedQueryPage extends QueryPage { } } + /** + * Does the Title currently exists + * + * This method allows a subclass to override this check + * (For example, wantedfiles, would want to check if the file exists + * not just that a page in the file namespace exists). + * + * This will only control if the link is crossed out. Whether or not the link + * is blue vs red is controlled by if the title exists. + * + * @note This will only be run if the page is cached (ie $wgMiserMode = true) + * unless forceExistenceCheck() is true. + * @since 1.24 + * @return bool + */ + protected function existenceCheck( Title $title ) { + return $title->isKnown(); + } + /** * Make a "what links here" link for a given title *