Last modified: 2007-07-23 12:05:24 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T11595, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 9595 - Add revisionId to ArticleSaveComplete hook
Add revisionId to ArticleSaveComplete hook
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2007-04-16 19:06 UTC by Christian Neubauer
Modified: 2007-07-23 12:05 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Christian Neubauer 2007-04-16 19:06:21 UTC
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.
Comment 1 Rob Church 2007-06-06 03:17:48 UTC
You have an Article object. Use it.
Comment 2 Christian Neubauer 2007-06-08 13:06:15 UTC
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.
Comment 3 Rob Church 2007-07-22 23:17:44 UTC
The new Revision is passed as the ninth argument to the ArticleSaveComplete (and ArticleInsertComplete) hook as of r24323.
Comment 4 Christian Neubauer 2007-07-23 12:05:24 UTC

Note You need to log in before you can comment on or make changes to this bug.