Page MenuHomePhabricator

Inappropriate things being done in Title::invalidateCache()
Closed, ResolvedPublic

Description

According to the doc comment of Title::invalidateCache(), its function is to update page_touched. This is a fine thing for a function to do. Lately, two more things have been added to it:

  • HTMLFileCache::clearFileCache()
  • Clear action=info cache

On the face of it, it would seem that WikiPage::onArticleEdit() would be a more appropriate place for these two activities, and indeed, one of them (the HTMLFileCache update) is already there.

One problem with adding the action=info update to Title::invalidateCache() is that the data on action=info needs to be updated when the page is edited, and Title::invalidateCache() is not called when the page is edited.

Another problem is that Title::invalidateCache() is called in circumstances when the data on action=info is *not* invalidated, for example when a revision is deleted with Special:RevisionDelete.

So I suggest removing the action=info cache clear from Title::invalidateCache(), adding it to WikiPage::onArticleEdit() and WikiPage::onArticleCreate() (factored out of course), and also adding it to any other Title::invalidateCache() caller that appears to need it.

Assigning to Tyler since he added the action=info cache clear.


Version: 1.21.x
Severity: normal

Details

Reference
bz46816

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 1:37 AM
bzimport added a project: MediaWiki-General.
bzimport set Reference to bz46816.

The only question, though, would be how the InfoAction cache would be flushed after the page is protected/unprotected, because those routes don't call WikiPage::onArticleEdit(). (They actually don't call Title::invalidateCache() either, so I doubt protection statuses are updating at all right now.)

(In reply to comment #1)

The only question, though, would be how the InfoAction cache would be flushed
after the page is protected/unprotected, because those routes don't call
WikiPage::onArticleEdit(). (They actually don't call Title::invalidateCache()
either, so I doubt protection statuses are updating at all right now.)

You're going to add a function that clears the action=info cache, right? InfoAction::clearCache( $title ) or something like that? You can have WikiPage::doUpdateRestrictions() call that function directly.

Related URL: https://gerrit.wikimedia.org/r/59848 (Gerrit Change I38ac616d2e99fb339aca33425745368ba85b6350)

Related URL: https://gerrit.wikimedia.org/r/62406 (Gerrit Change Ic12c66446c0d71f567dceb5d4630382ff41ad8bf)