r10512 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10511‎ | r10512 | r10513 >
Date:02:57, 15 August 2005
Author:avar
Status:old
Tags:
Comment:
* New special page: SpecialMostlinked
Modified paths:
  • /trunk/phase3/includes/QueryPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialMostlinked.php (added) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialMostlinked.php
@@ -0,0 +1,69 @@
 2+<?php
 3+/**
 4+ *
 5+ * @package MediaWiki
 6+ * @subpackage SpecialPage
 7+ */
 8+
 9+require_once ( 'QueryPage.php' ) ;
 10+
 11+/**
 12+ *
 13+ * @package MediaWiki
 14+ * @subpackage SpecialPage
 15+ */
 16+class MostlinkedPage extends QueryPage {
 17+
 18+ function getName() {
 19+ return 'Mostlinked';
 20+ }
 21+
 22+ function isExpensive() {
 23+ return true;
 24+ }
 25+ function isSyndicated() { return false; }
 26+
 27+ function getSQL() {
 28+ $dbr =& wfGetDB( DB_SLAVE );
 29+ extract( $dbr->tableNames( 'pagelinks', 'page' ) );
 30+ return
 31+ "SELECT 'Mostlinked' AS type,
 32+ pl_namespace AS namespace,
 33+ pl_title AS title,
 34+ COUNT(*) AS value,
 35+ page_namespace
 36+ FROM $pagelinks
 37+ LEFT JOIN $page ON pl_namespace=page_namespace AND pl_title=page_title
 38+ GROUP BY pl_namespace,pl_title
 39+ HAVING COUNT(*) > 1";
 40+ }
 41+
 42+ function formatResult( $skin, $result ) {
 43+ global $wgContLang;
 44+
 45+ $nt = Title::makeTitle( $result->namespace, $result->title );
 46+ $text = $wgContLang->convert( $nt->getPrefixedText() );
 47+ if ( is_null( $result->page_namespace ) )
 48+ $plink = $skin->makeBrokenLink( $nt->getPrefixedText(), $text );
 49+ else
 50+ $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
 51+
 52+ $nl = wfMsg( "nlinks", $result->value );
 53+ $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl, "target=" . $nt->getPrefixedURL() );
 54+
 55+ return "{$plink} ({$nlink})";
 56+ }
 57+}
 58+
 59+/**
 60+ * constructor
 61+ */
 62+function wfSpecialMostlinked() {
 63+ list( $limit, $offset ) = wfCheckLimits();
 64+
 65+ $wpp = new MostlinkedPage();
 66+
 67+ $wpp->doQuery( $offset, $limit );
 68+}
 69+
 70+?>
Property changes on: trunk/phase3/includes/SpecialMostlinked.php
___________________________________________________________________
Added: svn:eol-style
171 + native
Added: svn:keywords
272 + Author Date Id Revision
Index: trunk/phase3/includes/QueryPage.php
@@ -29,6 +29,7 @@
3030 array( 'UncategorizedPagesPage', 'Uncategorizedpages'),
3131 array( 'UnusedimagesPage', 'Unusedimages' ),
3232 array( 'WantedPagesPage', 'Wantedpages' ),
 33+ array( 'MostlinkedPage', 'Mostlinked' ),
3334 );
3435
3536 global $wgDisableCounters;
Index: trunk/phase3/languages/Language.php
@@ -1128,6 +1128,7 @@
11291129 'popularpages' => 'Popular pages',
11301130 'nviews' => '$1 views',
11311131 'wantedpages' => 'Wanted pages',
 1132+'mostlinked' => 'Most linked to pages',
11321133 'nlinks' => '$1 links',
11331134 'allpages' => 'All pages',
11341135 'randompage' => 'Random page',

Status & tagging log