Page MenuHomePhabricator

MediaWiki9508.patch

Authored By
bzimport
Nov 21 2014, 9:40 PM
Size
5 KB
Referenced Files
None
Subscribers
None

MediaWiki9508.patch

Index: includes/AutoLoader.php
===================================================================
--- includes/AutoLoader.php (revision 20632)
+++ includes/AutoLoader.php (working copy)
@@ -185,6 +185,7 @@
'MostlinkedPage' => 'includes/SpecialMostlinked.php',
'MostlinkedCategoriesPage' => 'includes/SpecialMostlinkedcategories.php',
'MostrevisionsPage' => 'includes/SpecialMostrevisions.php',
+ 'FewestrevisionsPage' => 'includes/SpecialFewestrevisions.php',
'MovePageForm' => 'includes/SpecialMovepage.php',
'NewbieContributionsPage' => 'includes/SpecialNewbieContributions.php',
'NewPagesPage' => 'includes/SpecialNewpages.php',
Index: includes/QueryPage.php
===================================================================
--- includes/QueryPage.php (revision 20632)
+++ includes/QueryPage.php (working copy)
@@ -27,6 +27,7 @@
array( 'MostlinkedCategoriesPage', 'Mostlinkedcategories' ),
array( 'MostlinkedPage', 'Mostlinked' ),
array( 'MostrevisionsPage', 'Mostrevisions' ),
+ array( 'FewestrevisionsPage', 'Fewestrevisions' ),
array( 'NewPagesPage', 'Newpages' ),
array( 'ShortPagesPage', 'Shortpages' ),
array( 'UncategorizedCategoriesPage', 'Uncategorizedcategories' ),
Index: includes/SpecialFewestrevisions.php
===================================================================
--- includes/SpecialFewestrevisions.php (revision 0)
+++ includes/SpecialFewestrevisions.php (revision 0)
@@ -0,0 +1,68 @@
+<?php
+/**
+ *
+ * Special page for listing the articles with the fewest revisions.
+ *
+ * Martin Drashkov
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+
+class FewestrevisionsPage extends QueryPage {
+
+ function getName() { return 'Fewestrevisions'; }
+ function isExpensive() { return true; }
+ function isSyndicated() { return false; }
+
+ function getSQL() {
+ $dbr = wfGetDB( DB_SLAVE );
+ list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
+
+ return
+ "
+ SELECT
+ 'Fewestrevisions' as type,
+ page_namespace as namespace,
+ page_title as title,
+ COUNT(*) as value
+ FROM $revision
+ JOIN $page ON page_id = rev_page
+ WHERE page_namespace = " . NS_MAIN . "
+ GROUP BY 1,2,3
+ HAVING COUNT(*) > 1
+ ";
+ }
+
+ function sortDescending() {
+ return false;
+ }
+
+ function formatResult( $skin, $result ) {
+ global $wgLang, $wgContLang;
+
+ $nt = Title::makeTitle( $result->namespace, $result->title );
+ $text = $wgContLang->convert( $nt->getPrefixedText() );
+
+ $plink = $skin->makeKnownLinkObj( $nt, $text );
+
+ $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
+ $wgLang->formatNum( $result->value ) );
+ $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
+
+ return wfSpecialList($plink, $nlink);
+ }
+}
+
+/**
+ * constructor
+ */
+function wfSpecialFewestrevisions() {
+ list( $limit, $offset ) = wfCheckLimits();
+
+ $wpp = new FewestrevisionsPage();
+
+ $wpp->doQuery( $offset, $limit );
+}
+
+?>
+
Index: includes/SpecialPage.php
===================================================================
--- includes/SpecialPage.php (revision 20632)
+++ includes/SpecialPage.php (working copy)
@@ -102,6 +102,7 @@
'Mostcategories' => array( 'SpecialPage', 'Mostcategories' ),
'Mostimages' => array( 'SpecialPage', 'Mostimages' ),
'Mostrevisions' => array( 'SpecialPage', 'Mostrevisions' ),
+ 'Fewestrevisions' => array( 'SpecialPage', 'Fewestrevisions' ),
'Shortpages' => array( 'SpecialPage', 'Shortpages' ),
'Longpages' => array( 'SpecialPage', 'Longpages' ),
'Newpages' => array( 'IncludableSpecialPage', 'Newpages' ),
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 20632)
+++ languages/messages/MessagesEn.php (working copy)
@@ -374,6 +374,7 @@
'Mostcategories' => array( 'Mostcategories' ),
'Mostimages' => array( 'Mostimages' ),
'Mostrevisions' => array( 'Mostrevisions' ),
+ 'Fewestrevisions' => array( 'Fewestrevisions' ),
'Shortpages' => array( 'Shortpages' ),
'Longpages' => array( 'Longpages' ),
'Newpages' => array( 'Newpages' ),
@@ -1544,6 +1545,7 @@
'mostimages' => 'Most linked to images',
'mostimages-summary' => '',
'mostrevisions' => 'Articles with the most revisions',
+'fewestrevisions' => 'Articles with the fewest revisions',
'mostrevisions-summary' => '',
'allpages' => 'All pages',
'allpages-summary' => '',
Index: maintenance/language/messages.inc
===================================================================
--- maintenance/language/messages.inc (revision 20632)
+++ maintenance/language/messages.inc (working copy)
@@ -942,6 +942,7 @@
'mostimages',
'mostimages-summary',
'mostrevisions',
+ 'fewestrevisions',
'mostrevisions-summary',
'allpages',
'allpages-summary',

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3435
Default Alt Text
MediaWiki9508.patch (5 KB)

Event Timeline