<?php
/**
+ * A special page to show pages ordered by the number of pages linking to them
*
* @package MediaWiki
* @subpackage SpecialPage
+ *
+ * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
+ * @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
*/
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' ) );
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
$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})";
}