Page MenuHomePhabricator

Page protection cache is not cleared across deletion and undeletion
Open, Needs TriagePublic

Description

rMW62b9d21ccc53: Add caching to Title::loadRestrictions() added caching to the loading of data from the page_restrictions table. It makes the assumption that any action that changes the protections will also create a null revision and therefore invalidate the key which is based on page ID and revision ID, but this is not true for the case when the page is deleted and undeleted.

To reproduce:

  1. Have your wiki set up to use persistent caching.
  2. Create a page, and protect it.
  3. Delete the page. Run jobs, if necessary.
  4. Observe that there are no entries for the page in the page_restrictions table.
  5. Undelete the page.
  6. Observe that there are still no entries for the page in the page_restrictions table.
  7. Observe that MediaWiki still thinks the page is protected.
  8. Flush the cache (e.g. restart memcached).
  9. Observe that MediaWiki now correctly shows the page as not being protected.

See also https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#MediaWiki_bug_-_undoing_a_protection