Fixes for r37489:
authorAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 10 Jul 2008 18:04:32 +0000 (18:04 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Thu, 10 Jul 2008 18:04:32 +0000 (18:04 +0000)
* Don't pass $data or $flags by reference.  They're never accessed again, so it makes no sense.
* Document in hooks.txt.
The interface for this hook seems very messy.  It seems like it would be much cleaner to expose $data as $url (null if stored locally); and $flags as an array, or something like that.  If the text is gzipped, the text can be extracted from the Revision and re-gzipped if you really want to for some strange reason.

docs/hooks.txt
includes/Revision.php

index bad937b..05f43db 100644 (file)
@@ -1011,7 +1011,13 @@ $form: the PreferencesForm
 $user: the User object to load preferences from
 
 'RevisionInsertComplete': called after a revision is inserted into the DB
-$revision: the Revision
+&$revision: the Revision
+$data: the data stored in old_text.  The meaning depends on $flags: if external
+  is set, it's the URL of the revision text in external storage; otherwise,
+  it's the revision text itself.  In either case, if gzip is set, the revision
+  text is gzipped.
+$flags: a comma-delimited list of strings representing the options used.  May
+  include: utf8 (this will always be set for new revisions); gzip; external.
 
 'SavePreferences': called at the end of PreferencesForm::savePreferences; 
                    returning false prevents the preferences from being saved.
index 09a25ec..d0ccb46 100644 (file)
@@ -773,7 +773,7 @@ class Revision {
 
                $this->mId = !is_null($rev_id) ? $rev_id : $dbw->insertId();
                
-               wfRunHooks( 'RevisionInsertComplete', array( &$this, &$data, &$flags ) );
+               wfRunHooks( 'RevisionInsertComplete', array( &$this, $data, $flags ) );
                
                wfProfileOut( __METHOD__ );
                return $this->mId;