Last modified: 2008-09-09 20:42:58 UTC
If a page is protected via an entry in the page table (instead of the page_restrictions table) and also cascade protected, the API doesn't return protection information about the page itself. This can be seen in the following query, where there are no results without a source= field. The accompanying SQL query shows that the page actually is protected; the user interface verifies en:Template:!! was protected in 2006. API query demonstrating the problem: http://en.wikipedia.org/w/api.php?action=query&prop=info&inprop=protection&titles=Template:!! Results: <?xml version="1.0" encoding="utf-8"?> <api> <query> <pages> <page pageid="5994763" ns="10" title="Template:!!" touched="2008-09-05T09:29:45Z" lastrevid="113778948" counter="0" length="65"> <protection> <pr type="edit" level="sysop" expiry="infinity" source="User:Hersfold/Lockbox" /> <pr type="move" level="sysop" expiry="infinity" source="User:Hersfold/Lockbox" /> </protection> </page> </pages> </query> </api> Protection status: mysql> select * from page left join page_restrictions on page_id = pr_page where page_title = '!!' and page_namespace= 10; +---------+----------------+------------+-----------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+---------+---------+----------+------------+---------+-----------+-------+ | page_id | page_namespace | page_title | page_restrictions | page_counter | page_is_redirect | page_is_new | page_random | page_touched | page_latest | page_len | pr_page | pr_type | pr_level | pr_cascade | pr_user | pr_expiry | pr_id | +---------+----------------+------------+-----------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+---------+---------+----------+------------+---------+-----------+-------+ | 5994763 | 10 | !! | edit=sysop:move=sysop | 0 | 0 | 0 | 0.189867044892 | 20080905092945 | 113778948 | 65 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | +---------+----------------+------------+-----------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+---------+---------+----------+------------+---------+-----------+-------+ 1 row in set (0.00 sec) Desired behavior: return results without a source= field, as this query does: http://en.wikipedia.org/w/api.php?action=query&prop=info&inprop=protection&titles=Template:*mp
The query I reported above, http://en.wikipedia.org/w/api.php?action=query&prop=info&inprop=protection&titles=Template now returns: <?xml version="1.0" encoding="utf-8"?> <api> <query> <pages> <page pageid="237862" ns="0" title="Template" touched="2008-09-06T22:42:09Z" lastrevid="236742124" counter="1" length="2341"> <protection /> </page> </pages> </query> </api> The page is still protected: mysql> select * from page left join page_restrictions on page_id = pr_page where page_namespace = 10 and page_title = '!!'; +---------+----------------+------------+-----------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+---------+---------+----------+------------+---------+-----------+-------+ | page_id | page_namespace | page_title | page_restrictions | page_counter | page_is_redirect | page_is_new | page_random | page_touched | page_latest | page_len | pr_page | pr_type | pr_level | pr_cascade | pr_user | pr_expiry | pr_id | +---------+----------------+------------+-----------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+---------+---------+----------+------------+---------+-----------+-------+ | 5994763 | 10 | !! | edit=sysop:move=sysop | 0 | 0 | 0 | 0.189867044892 | 20080905092945 | 113778948 | 65 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | +---------+----------------+------------+-----------------------+--------------+------------------+-------------+----------------+----------------+-------------+----------+---------+---------+----------+------------+---------+-----------+-------+ 1 row in set (0.00 sec) And the page is still cascade protected, according to the enwiki user interface.
(In reply to comment #1) > The query I reported above, > > http://en.wikipedia.org/w/api.php?action=query&prop=info&inprop=protection&titles=Template Specifying the right title ([[Template:!!]] as opposed to [[Template]]) helps.
Sorry about that; didn't realize bugzilla trims !! off the link. I'm embarrassed.
Fixed in r40678.