Last modified: 2007-07-23 12:05:24 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.
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.
The new Revision is passed as the ninth argument to the ArticleSaveComplete (and ArticleInsertComplete) hook as of r24323.
Thanks.