From: Ævar Arnfjörð Bjarmason Date: Fri, 16 Sep 2005 15:07:07 +0000 (+0000) Subject: * Documentation X-Git-Tag: 1.6.0~1631 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=58993df36c39e5db617efa9d19509036eca7391b;p=lhc%2Fweb%2Fwiklou.git * Documentation * Fixes for when $this->isCached() is true --- 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})"; }