From 5620dbebef474360f14477294d8ea7c1fe4c7987 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Mon, 15 Aug 2005 02:57:19 +0000 Subject: [PATCH] * New special page: SpecialMostlinked --- includes/QueryPage.php | 1 + includes/SpecialMostlinked.php | 69 ++++++++++++++++++++++++++++++++++ languages/Language.php | 1 + 3 files changed, 71 insertions(+) create mode 100644 includes/SpecialMostlinked.php diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 172849d315..d6ec7688ba 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -29,6 +29,7 @@ $wgQueryPages = array( array( 'UncategorizedPagesPage', 'Uncategorizedpages'), array( 'UnusedimagesPage', 'Unusedimages' ), array( 'WantedPagesPage', 'Wantedpages' ), + array( 'MostlinkedPage', 'Mostlinked' ), ); global $wgDisableCounters; diff --git a/includes/SpecialMostlinked.php b/includes/SpecialMostlinked.php new file mode 100644 index 0000000000..008a2d4123 --- /dev/null +++ b/includes/SpecialMostlinked.php @@ -0,0 +1,69 @@ +tableNames( 'pagelinks', 'page' ) ); + return + "SELECT 'Mostlinked' AS type, + pl_namespace AS namespace, + pl_title AS title, + COUNT(*) AS value, + page_namespace + FROM $pagelinks + LEFT JOIN $page ON pl_namespace=page_namespace AND pl_title=page_title + GROUP BY pl_namespace,pl_title + HAVING COUNT(*) > 1"; + } + + function formatResult( $skin, $result ) { + global $wgContLang; + + $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 + $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text ); + + $nl = wfMsg( "nlinks", $result->value ); + $nlink = $skin->makeKnownLink( $wgContLang->specialPage( "Whatlinkshere" ), $nl, "target=" . $nt->getPrefixedURL() ); + + return "{$plink} ({$nlink})"; + } +} + +/** + * constructor + */ +function wfSpecialMostlinked() { + list( $limit, $offset ) = wfCheckLimits(); + + $wpp = new MostlinkedPage(); + + $wpp->doQuery( $offset, $limit ); +} + +?> diff --git a/languages/Language.php b/languages/Language.php index db87a74b7e..292309f43f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1128,6 +1128,7 @@ That comes to '''$5''' average edits per page, and '''$6''' views per edit.", 'popularpages' => 'Popular pages', 'nviews' => '$1 views', 'wantedpages' => 'Wanted pages', +'mostlinked' => 'Most linked to pages', 'nlinks' => '$1 links', 'allpages' => 'All pages', 'randompage' => 'Random page', -- 2.20.1