__IGNOREUNUSED__ excludes cats from UnusedCategories
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 25 Jan 2009 12:43:55 +0000 (12:43 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 25 Jan 2009 12:43:55 +0000 (12:43 +0000)
An extra left join and filter condition added to the query.  Should
cause no significant performance issues.  Patch by Ahmad Sherif (bug
17145).

CREDITS
RELEASE-NOTES
includes/MagicWord.php
includes/parser/Parser.php
includes/specials/SpecialUnusedcategories.php
languages/messages/MessagesEn.php

diff --git a/CREDITS b/CREDITS
index f21448a..adb1d86 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -56,6 +56,7 @@ following names for their contribution to the product.
 
 == Patch Contributors ==
 * Agbad
+* Ahmad Sherif
 * Brad Jorsch
 * Brent G
 * Daniel Arnold
index 6153ba1..237f33b 100644 (file)
@@ -60,6 +60,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   link instead of Go button & Search button
 * (bug 2314) Add links to user custom CSS and JS to Special:Preferences
 * More helpful error message on raw page access if PHP_SELF isn't set
+* (bug 17145) Specific categories can be excluded from Special:UnusedCategories
+  with __IGNOREUNUSED__
 
 === Bug fixes in 1.15 ===
 * (bug 16968) Special:Upload no longer throws useless warnings.
index 5b5b77f..2700273 100644 (file)
@@ -159,6 +159,7 @@ class MagicWord {
                'noeditsection',
                'newsectionlink',
                'hiddencat',
+               'ignoreunused',
                'index',
                'noindex',
                'staticredirect',
index b8c1325..e79f8cf 100644 (file)
@@ -3439,6 +3439,9 @@ class Parser
                                wfDebug( __METHOD__.": [[MediaWiki:hidden-category-category]] is not a valid title!\n" );
                        }
                }
+               if ( isset( $this->mDoubleUnderscores['ignoreunused'] ) && $this->mTitle->getNamespace() == NS_CATEGORY ) {
+                       $this->mOutput->setProperty( 'ignoreunused', 'y' );
+               }
                # (bug 8068) Allow control over whether robots index a page.
                #
                # FIXME (bug 14899): __INDEX__ always overrides __NOINDEX__ here!  This
index 406f794..ced32d9 100644 (file)
@@ -22,14 +22,16 @@ class UnusedCategoriesPage extends QueryPage {
        function getSQL() {
                $NScat = NS_CATEGORY;
                $dbr = wfGetDB( DB_SLAVE );
-               list( $categorylinks, $page ) = $dbr->tableNamesN( 'categorylinks', 'page' );
+               list( $categorylinks, $page, $page_props ) = $dbr->tableNamesN( 'categorylinks', 'page', 'page_props' );
                return "SELECT 'Unusedcategories' as type,
                                {$NScat} as namespace, page_title as title, page_title as value
                                FROM $page
                                LEFT JOIN $categorylinks ON page_title=cl_to
+                               LEFT JOIN $page_props ON pp_page=page_id
                                WHERE cl_from IS NULL
                                AND page_namespace = {$NScat}
-                               AND page_is_redirect = 0";
+                               AND page_is_redirect = 0
+                               AND (pp_propname IS NULL OR pp_propname != 'ignoreunused')";
        }
 
        function formatResult( $skin, $result ) {
index b57631a..4f15394 100644 (file)
@@ -327,6 +327,7 @@ $magicWords = array(
        'filepath'               => array( 0,    'FILEPATH:'              ),
        'tag'                    => array( 0,    'tag'                    ),
        'hiddencat'              => array( 1,    '__HIDDENCAT__'          ),
+       'ignoreunused'           => array( 1,    '__IGNOREUNUSED__'       ),
        'pagesincategory'        => array( 1,    'PAGESINCATEGORY', 'PAGESINCAT' ),
        'pagesize'               => array( 1,    'PAGESIZE'               ),
        'index'                  => array( 1,    '__INDEX__'              ),