Page MenuHomePhabricator

Add revisionId to ArticleSaveComplete hook
Closed, ResolvedPublic


I use an extension on my local wiki that requires access to the revision id of
an inserted article after the article is saved. I am requesting that it be
added to the ArticleSaveComplete hook fired in Article->doEdit(). There don't
seem to be any downsides to this unless there are issues with databases other
than mySQL that I'm unaware of. The new hook would look something like this:

wfRunHooks( 'ArticleSaveComplete',

array( &$this, &$wgUser, $text,
  $summary, $flags & EDIT_MINOR,
  null, null, &$flags, $revisionId )


Alternately, the revision object that is created in doEdit before
ArticleSaveComplete is fired could be attached to the Article object's mRevision
member variable so that an extension could call $article->mRevision->mId or
something along those lines.

Version: 1.10.x
Severity: enhancement



Event Timeline

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

robchur wrote:

You have an Article object. Use it.

Thanks for the suggestion. As far as I can tell, there is no point in the doEdit() function where the $article->mRevision is updated with the new revision information. updateRevisionOn() updates the revision information in the database, but apparently does not set $article->mRevision to the new revision. editUpdates() updates site stats and such but again doesn't appear to update $article->mRevision.

So the $article passed to the ArticleSaveComplete hook still points to the old revision. Perhaps you are suggesting I recall $article->fetchContent() and then check the revision information? If that's what you are recommending I will try that, but I would suggest that it would make more sense to update the mRevision member of $article before the hook is called so that the hook recipient has the most recent version of the saved $article.

If I am misunderstanding your terse, jackass-y comment please let me know.

robchur wrote:

The new Revision is passed as the ninth argument to the ArticleSaveComplete (and ArticleInsertComplete) hook as of r24323.