From 874d1d6990f9e4f438bfc5e44ed121d76e5943ad Mon Sep 17 00:00:00 2001 From: Rob Church Date: Sun, 8 Apr 2007 07:23:15 +0000 Subject: [PATCH] (bug 9508) Special page to list articles with the fewest revisions, based on http://bugzilla.wikimedia.org/attachment.cgi?id=3421&action=view with minor modification --- RELEASE-NOTES | 3 +- includes/AutoLoader.php | 1 + includes/QueryPage.php | 3 +- includes/SpecialFewestrevisions.php | 68 +++++++++++++++++++++++++++++ includes/SpecialPage.php | 1 + languages/messages/MessagesEn.php | 3 ++ maintenance/language/messages.inc | 1 + 7 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 includes/SpecialFewestrevisions.php diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5fdf3968c9..e528ec2204 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index ca9d92e636..7bf879e51f 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -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', diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 75dc112c2b..909ca7d4c5 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -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 index 0000000000..ca6c710d28 --- /dev/null +++ b/includes/SpecialFewestrevisions.php @@ -0,0 +1,68 @@ +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 ); +} + +?> + diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 2816b873e7..4bcdf8a111 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -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' ), diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 1bb2f21300..f087152b7a 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -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}}', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 78403cbadc..7aa472195b 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -947,6 +947,7 @@ $wgMessageStructure = array( 'mostimages-summary', 'mostrevisions', 'mostrevisions-summary', + 'fewestrevisions', 'allpages', 'allpages-summary', 'prefixindex', -- 2.20.1