From 58993df36c39e5db617efa9d19509036eca7391b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Fri, 16 Sep 2005 15:07:07 +0000 Subject: [PATCH] * Documentation * Fixes for when $this->isCached() is true --- includes/SpecialMostlinked.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/includes/SpecialMostlinked.php b/includes/SpecialMostlinked.php index c7926380bb..89ee2231d3 100644 --- a/includes/SpecialMostlinked.php +++ b/includes/SpecialMostlinked.php @@ -1,14 +1,18 @@ + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later */ -require_once ( 'QueryPage.php' ) ; +/* */ +require_once 'QueryPage.php'; /** - * * @package MediaWiki * @subpackage SpecialPage */ @@ -18,6 +22,9 @@ class MostlinkedPage extends QueryPage { function isExpensive() { return true; } function isSyndicated() { return false; } + /** + * Note: Getting page_namespace only works if $this->isCached() is false + */ function getSQL() { $dbr =& wfGetDB( DB_SLAVE ); extract( $dbr->tableNames( 'pagelinks', 'page' ) ); @@ -26,7 +33,7 @@ class MostlinkedPage extends QueryPage { pl_namespace AS namespace, pl_title AS title, COUNT(*) AS value, - -- FIXME: The presence of this is a bug + page_namespace FROM $pagelinks LEFT JOIN $page ON pl_namespace=page_namespace AND pl_title=page_title @@ -39,13 +46,17 @@ class MostlinkedPage extends QueryPage { $nt = Title::makeTitle( $result->namespace, $result->title ); $text = $wgContLang->convert( $nt->getPrefixedText() ); - if ( is_null( $result->page_namespace ) ) - $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text ); - else + + if ( $this->isCached() ) $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text ); + else { + $plink = is_null( $result->page_namespace ) + ? $skin->makeBrokenLink( $nt->getPrefixedText(), $text ) + : $skin->makeKnownLink( $nt->getPrefixedText(), $text ); + } - $nl = wfMsg( "nlinks", $result->value ); - $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl, "target=" . $nt->getPrefixedURL() ); + $nl = wfMsg( 'nlinks', $result->value ); + $nlink = $skin->makeKnownLink( $wgContLang->specialPage( 'Whatlinkshere' ), $nl, 'target=' . $nt->getPrefixedURL() ); return "{$plink} ({$nlink})"; } -- 2.20.1