Issue:Articlecategory doesn't work in 1.6.8

From FollowTheScore
Jump to: navigation, search
Description: articlecategory produces no output
Extension / Version: DPL   /   1.6.8
Type / Status: Bug   /   closed

Problem

This example produces no output on MediaWiki 1.11.x and 1.12.0 on Windows 2003 Server.

<dpl>
namespace = Talk
articlecategory = My category
</dpl>

even if there are articles in "My category" that have talk pages. I would expect to see a bulleted list of all Talk pages whose main article is in "My category".

This problem exists in DPL 1.6.5 as well.

This is with PHP 5.2.5 and Apache 2.2.8 and mySQL 5.0.45-community-nt-log.

Reply

Obviously it works here (MW 1.11, see Special:Version):

Try to use debug=3 and check the SQL statement and fire it (using copy/paste) against your database using a SQL shell; does it produce the correct result list?

Gero 10:40, 4 April 2008 (CEST)

Using debug = 3

I tried debug = 3, and the inner select statement returns an empty result:

select p2.page_title
from vpw_page p2
inner join vpw_categorylinks clstc
 ON (clstc.cl_from = p2.page_id AND clstc.cl_to = 'my category name' )
where p2.page_namespace = 0;

which makes the whole query return an empty result. If I remove the inner join to vpw_categorylinks, I get lots of results.

Here is the whole query:

SELECT DISTINCT `vpw_page`.page_namespace as
page_namespace,`vpw_page`.page_title as page_title,
REPLACE(REPLACE(CONCAT( IF(`vpw_page`.page_namespace=0, , CONCAT(CASE
`vpw_page`.page_namespace WHEN 1 THEN 'Talk' WHEN 2 THEN 'User' WHEN 3
THEN 'User_talk' WHEN 4 THEN 'TechWiki' WHEN 5 THEN 'TechWiki_talk'
WHEN 6 THEN 'Image' WHEN 7 THEN 'Image_talk' WHEN 8 THEN 'MediaWiki'
WHEN 9 THEN 'MediaWiki_talk' WHEN 10 THEN 'Template' WHEN 11 THEN
'Template_talk' WHEN 12 THEN 'Help' WHEN 13 THEN 'Help_talk' WHEN 14
THEN 'Category' WHEN 15 THEN 'Category_talk' WHEN 100 THEN 'Preset'
WHEN 101 THEN 'Preset_talk' WHEN 200 THEN 'Extension' WHEN 201 THEN
'Extension_talk' WHEN 202 THEN 'Temp' WHEN 203 THEN 'Temp_talk' END,
':')), `vpw_page`.page_title), '_', ' '),'?','?') as sortkey FROM
`vpw_page` WHERE 1=1 AND `vpw_page`.page_namespace IN ('1') AND
`vpw_page`.page_is_redirect=0 AND `vpw_page`.page_title IN (
  select p2.page_title
  from `vpw_page` p2
  inner join `vpw_categorylinks` clstc ON (clstc.cl_from = p2.page_id 
  AND clstc.cl_to = 'my category name' )
  where p2.page_namespace = 0
  )  ORDER BY sortkey ASC LIMIT 0, 500

--Maiden taiwan 22:32, 8 April 2008 (CEST)

Problem found!

I found the cause. The cl_to column of the categorylinks table contains underscores, not space characters. Your query assumes space characters. Where you have:

WHERE clstc.cl_to = 'my category name'

you would need:

WHERE clstc.cl_to = 'my_category_name'

When I try this, it works:

<dpl>
namespace = Talk
articlecategory = My_category     notice the underscore
</dpl>

--Maiden taiwan 22:41, 8 April 2008 (CEST)

Bug Fix

Thank you for bringing this up. For the moment you can replace all spaces in category names by underscores within your DPL query. I will make a bug fix in the next release which will automatically perform the necessary replacement.

Gero 09:55, 9 April 2008 (CEST)
Thank you! Maiden taiwan 22:15, 9 April 2008 (CEST)