Page MenuHomePhabricator

Trigger hook on page rollback
Closed, ResolvedPublic

Description

As far as I can see, there is currently no way for an extension to react to a
page being undeleted (restored) or an edit being rolled-back.

This means that extensions which cache meta-data based on the page contents will
go out of sync if either of these situations occur.

I don't know if either of these warrant a new hook, or whether
ArticleInsertComplete (for undelete) and ArticleSave/ArticleSaveComplete (for
rollback) should be re-used.

I am happy to implement a patch for this if someone can advise me on the best
method.


Version: unspecified
Severity: enhancement

Details

Reference
bz8136

Related Objects

StatusSubtypeAssignedTask
ResolvedNone
ResolvedNone

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:29 PM
bzimport set Reference to bz8136.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

New hooks sound appropriate to me.

Article::onArticleCreate() looks like the right place for a lower-level article
creation hook than 'ArticleInsertComplete'.

However, Article::onArticleCreate() is used as a cache clearing function from
Title.php which makes it a misnomer. I recommend separating it into a function
which reflects its name and calls an 'OnArticleCreate' hook and a new
cache-clearing function with a name to match which can be called from Title.php
when moving articles.

robchur wrote:

'ArticleUndelete' hook added in r19441. Repurposing bug to the rollback hook.

Handled via ArticleRollbackComplete, as of 1.12.