(bug 9508) Special page to list articles with the fewest revisions, based on http...
authorRob Church <robchurch@users.mediawiki.org>
Sun, 8 Apr 2007 07:23:15 +0000 (07:23 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sun, 8 Apr 2007 07:23:15 +0000 (07:23 +0000)
RELEASE-NOTES
includes/AutoLoader.php
includes/QueryPage.php
includes/SpecialFewestrevisions.php [new file with mode: 0644]
includes/SpecialPage.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 5fdf396..e528ec2 100644 (file)
@@ -110,7 +110,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 9177) Installer now warns of various conditions affecting session.save_path
   which can lead to broken session storage
 * (bug 9046) Special page to list pages without language links
-* Predefined block reasons added to special:blockip
+* Predefined block reasons added to Special:Blockip
+* (bug 9508) Special page to list articles with the fewest revisions
 
 == Bugfixes since 1.9 ==
 * (bug 7292) Fix site statistics when moving pages in/out of content namespaces
index ca9d92e..7bf879e 100644 (file)
@@ -186,6 +186,7 @@ function __autoload($className) {
                '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 75dc112..909ca7d 100644 (file)
@@ -27,6 +27,7 @@ $wgQueryPages = array(
        array( 'MostlinkedCategoriesPage',      'Mostlinkedcategories'          ),
        array( 'MostlinkedPage',                'Mostlinked'                    ),
        array( 'MostrevisionsPage',             'Mostrevisions'                 ),
+       array( 'FewestrevisionsPage',           'Fewestrevisions'               ),
        array( 'NewPagesPage',                  'Newpages'                      ),
        array( 'ShortPagesPage',                'Shortpages'                    ),
        array( 'UncategorizedCategoriesPage',   'Uncategorizedcategories'       ),
@@ -524,4 +525,4 @@ class QueryPage {
        }
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/includes/SpecialFewestrevisions.php b/includes/SpecialFewestrevisions.php
new file mode 100644 (file)
index 0000000..ca6c710
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ *
+ * Special page for listing the articles with the fewest revisions.  
+ * 
+ * @package MediaWiki
+ * @subpackage Special pages
+ * @author Martin Drashkov 
+ */
+
+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::makeTitleSafe( $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 );
+       }
+}
+
+function wfSpecialFewestrevisions() {
+       list( $limit, $offset ) = wfCheckLimits();
+       $frp = new FewestrevisionsPage();
+       $frp->doQuery( $offset, $limit );
+}
+
+?>
+
index 2816b87..4bcdf8a 100644 (file)
@@ -102,6 +102,7 @@ class SpecialPage
                '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 1bb2f21..f087152 100644 (file)
@@ -374,6 +374,7 @@ $specialPageAliases = array(
        'Mostcategories'            => array( 'Mostcategories' ),
        'Mostimages'                => array( 'Mostimages' ),
        'Mostrevisions'             => array( 'Mostrevisions' ),
+       'Fewestrevisions'           => array( 'Fewestrevisions' ),
        'Shortpages'                => array( 'Shortpages' ),
        'Longpages'                 => array( 'Longpages' ),
        'Newpages'                  => array( 'Newpages' ),
@@ -1513,6 +1514,8 @@ The [http://meta.wikimedia.org/wiki/Help:Job_queue job queue] length is '''$7'''
 'withoutinterwiki' => 'Pages without language links',
 'withoutinterwiki-header' => 'The following pages do not link to other language versions:',
 
+'fewestrevisions' => 'Articles with the fewest revisions',
+
 # Miscellaneous special pages
 #
 'nbytes'               => '$1 {{PLURAL:$1|byte|bytes}}',
index 78403cb..7aa4721 100644 (file)
@@ -947,6 +947,7 @@ $wgMessageStructure = array(
                'mostimages-summary',
                'mostrevisions',
                'mostrevisions-summary',
+               'fewestrevisions',
                'allpages',
                'allpages-summary',
                'prefixindex',