r10515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10514‎ | r10515 | r10516 >
Date:03:03, 15 August 2005
Author:avar
Status:old
Tags:
Comment:
* New special page: SpecialMostlinked
Modified paths:
  • /branches/REL1_5/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_5/phase3/includes/QueryPage.php (modified) (history)
  • /branches/REL1_5/phase3/includes/SpecialMostlinked.php (added) (history)
  • /branches/REL1_5/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: branches/REL1_5/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: branches/REL1_5/phase3/includes/SpecialMostlinked.php
___________________________________________________________________
Added: svn:eol-style
171 + native
Added: svn:keywords
272 + Author Date Id Revision
Index: branches/REL1_5/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: branches/REL1_5/phase3/RELEASE-NOTES
@@ -649,6 +649,7 @@
650650 * (bug 3092) Wrong numerical separator for big numbers in Serbian.
651651 * (bug 2855) Credit for a uniq author showed its realname even with
652652 $wgAllowRealName=false.
 653+* New special page: SpecialMostlinked
653654
654655 === Caveats ===
655656
Index: branches/REL1_5/phase3/languages/Language.php
@@ -1123,6 +1123,7 @@
11241124 'popularpages' => 'Popular pages',
11251125 'nviews' => '$1 views',
11261126 'wantedpages' => 'Wanted pages',
 1127+'mostlinked' => 'Most linked to pages',
11271128 'nlinks' => '$1 links',
11281129 'allpages' => 'All pages',
11291130 'randompage' => 'Random page',

Status & tagging log