Page MenuHomePhabricator

clshow considers all categories !hidden
Closed, ResolvedPublic

Description

The clshow parameter for prop=categories seems to consider all categories as being not hidden, or else the API's definition of "hidden" isn't what is shown as "Hidden categories" at the bottom of the article page. For example, the following query should return at least one category for every page returned since it is querying the categories of pages in a hidden category:

http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Pages_with_incorrect_ref_formatting&prop=categories&cllimit=max&clshow=hidden

However, at least in revision r40356, no categories are returned. All the categories, even the hidden one, are returned when !hidden is requested:

http://en.wikipedia.org/w/api.php?action=query&generator=categorymembers&gcmtitle=Category:Pages_with_incorrect_ref_formatting&prop=categories&cllimit=max&clshow=!hidden

I notice that OutputPage.php does the "hidden category" thing in a completely different way.


Version: unspecified
Severity: normal

Details

Reference
bz15579

Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:19 PM
bzimport set Reference to bz15579.

Caused by bug 15191, but there seem to be no plans to fix it. I'll run the check against the page_props table, then.

Bryan.TongMinh wrote:

There have to be some nasty LEFT JOINs. Something with

LEFT JOIN page ON (NS_CATEGORY, cl_to) = (page_namespace, page_title) LEFT JOIN page_props ON pp_page = page_id AND pp_propname = 'hidden' WHERE ...

Not nice.

Created attachment 5580
This should implement the query discussed in bug 15191

This patch should implement the query discussed in bug 15191:

SELECT /*! STRAIGHT_JOIN */ cl_from,cl_to FROM categorylinks LEFT JOIN page ON
page_namespace = '14' AND page_title = cl_to LEFT JOIN page_props ON pp_page =
page_id AND pp_propname = 'hiddencat' WHERE cl_from IN ('85', '92', '111',
'138') AND pp_propname IS NOT NULL ORDER BY cl_from, cl_to;

Attached:

Modified patch applied in r44585.