Fix last commit, was broken
authorAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 25 Jan 2009 15:23:56 +0000 (15:23 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Sun, 25 Jan 2009 15:23:56 +0000 (15:23 +0000)
Per code review by P. Copp:

<http://www.mediawiki.org/wiki/Special:Code/MediaWiki/46196/reply/1407#c1407>

The conditions on the join would only work if the category had no other
page_props.  Otherwise it would return incorrect results.

includes/specials/SpecialUnusedcategories.php

index ced32d9..8ed4078 100644 (file)
@@ -27,11 +27,11 @@ class UnusedCategoriesPage extends QueryPage {
                                {$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
+                               LEFT JOIN $page_props ON (pp_page=page_id AND pp_propname = 'ignoreunused')
                                WHERE cl_from IS NULL
                                AND page_namespace = {$NScat}
                                AND page_is_redirect = 0
-                               AND (pp_propname IS NULL OR pp_propname != 'ignoreunused')";
+                               AND pp_propname IS NULL";
        }
 
        function formatResult( $skin, $result ) {