From 8ac8be9921c100ce988a08ddb8b81c00f1cdfd4d Mon Sep 17 00:00:00 2001
From: Antoine Musso
Date: Sat, 9 Jul 2005 19:19:10 +0000
Subject: [PATCH] Fix #1064 by implementing the new Special:Unusedcategories
(thanks avar for the name)
---
RELEASE-NOTES | 2 ++
includes/SpecialPage.php | 1 +
includes/SpecialUnusedcategories.php | 52 ++++++++++++++++++++++++++++
languages/Language.php | 3 ++
4 files changed, 58 insertions(+)
create mode 100644 includes/SpecialUnusedcategories.php
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 9968572aa1..0d390b6219 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -549,6 +549,8 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new.
interesting errors with signitures.
* (bug 2764) Number format for Nds
* (bug 1553) Stop forcing lowercase in Monobook skin for German language.
+* (bug 1064) Implements Special:Unusedcategories
+
=== Caveats ===
diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php
index 2487405776..5f67310237 100644
--- a/includes/SpecialPage.php
+++ b/includes/SpecialPage.php
@@ -44,6 +44,7 @@ $wgSpecialPages = array(
'Lonelypages' => new SpecialPage( 'Lonelypages' ),
'Uncategorizedpages'=> new SpecialPage( 'Uncategorizedpages' ),
'Uncategorizedcategories'=> new SpecialPage( 'Uncategorizedcategories' ),
+ 'Unusedcategories' => new SpecialPage( 'Unusedcategories' ),
'Unusedimages' => new SpecialPage( 'Unusedimages' ),
'Wantedpages' => new SpecialPage( 'Wantedpages' ),
'Shortpages' => new SpecialPage( 'Shortpages' ),
diff --git a/includes/SpecialUnusedcategories.php b/includes/SpecialUnusedcategories.php
new file mode 100644
index 0000000000..9696db9baa
--- /dev/null
+++ b/includes/SpecialUnusedcategories.php
@@ -0,0 +1,52 @@
+'.wfMsg('unusedcategoriestext')."
\n";
+ }
+
+ function getSQL() {
+ $NScat = NS_CATEGORY;
+ $dbr =& wfGetDB( DB_SLAVE );
+ extract( $dbr->tableNames( 'categorylinks','page' ));
+ return "SELECT DISTINCT 'Unusedcategories' as type,
+ {$NScat} as namespace, page_title as title, 1 as value
+ FROM $page
+ LEFT JOIN $categorylinks ON page_title=cl_to
+ WHERE cl_from IS NULL
+ AND page_namespace = {$NScat}
+ AND page_is_redirect = 0";
+ }
+
+ function formatResult( $skin, $result ) {
+ global $wgLang;
+ $title = Title::makeTitle( NS_CATEGORY, $result->title );
+ return $skin->makeLinkObj( $title, $title->getText() );
+ }
+}
+
+/** constructor */
+function wfSpecialUnusedCategories() {
+ list( $limit, $offset ) = wfCheckLimits();
+ $uc = new UnusedCategoriesPage();
+ return $uc->doQuery( $offset, $limit );
+}
+?>
diff --git a/languages/Language.php b/languages/Language.php
index 7d29c8aac3..1b3cae247f 100644
--- a/languages/Language.php
+++ b/languages/Language.php
@@ -1117,6 +1117,7 @@ That comes to '''$5''' average edits per page, and '''$6''' views per edit.",
'lonelypages' => 'Orphaned pages',
'uncategorizedpages' => 'Uncategorized pages',
'uncategorizedcategories' => 'Uncategorized categories',
+'unusedcategories' => 'Unused categories',
'unusedimages' => 'Unused files',
'popularpages' => 'Popular pages',
'nviews' => '$1 views',
@@ -1156,6 +1157,8 @@ That comes to '''$5''' average edits per page, and '''$6''' views per edit.",
'unusedimagestext' => 'Please note that other web sites may link to an image with
a direct URL, and so may still be listed here despite being
in active use.
',
+'unusedcategoriestext' => 'The following categorie pages exist although no other article or category make use of them.
',
+
'booksources' => 'Book sources',
'categoriespagetext' => 'The following categories exist in the wiki.',
'data' => 'Data',
--
2.20.1