Merge "Added a script to compare current parser output to cache"
[lhc/web/wiklou.git] / includes / Revision.php
index 7b30540..b0423fb 100644 (file)
@@ -134,8 +134,8 @@ class Revision implements IDBAccessObject {
         *      Revision::READ_LATEST  : Select the data from the master (since 1.20)
         *      Revision::READ_LOCKING : Select & lock the data from the master
         *
-        * @param int $revId
-        * @param int $pageId (optional)
+        * @param int $pageId
+        * @param int $revId (optional)
         * @param int $flags Bitfield (optional)
         * @return Revision|null
         */
@@ -1201,18 +1201,18 @@ class Revision implements IDBAccessObject {
        }
 
        /**
-         * Get revision text associated with an old or archive row
-         * $row is usually an object from wfFetchRow(), both the flags and the text
-         * field must be included.
-         *
-         * @param stdClass $row The text data
-         * @param string $prefix Table prefix (default 'old_')
-         * @param string|bool $wiki The name of the wiki to load the revision text from
-         *   (same as the the wiki $row was loaded from) or false to indicate the local
-         *   wiki (this is the default). Otherwise, it must be a symbolic wiki database
-         *   identifier as understood by the LoadBalancer class.
-         * @return string Text the text requested or false on failure
-         */
+        * Get revision text associated with an old or archive row
+        * $row is usually an object from wfFetchRow(), both the flags and the text
+        * field must be included.
+        *
+        * @param stdClass $row The text data
+        * @param string $prefix Table prefix (default 'old_')
+        * @param string|bool $wiki The name of the wiki to load the revision text from
+        *   (same as the the wiki $row was loaded from) or false to indicate the local
+        *   wiki (this is the default). Otherwise, it must be a symbolic wiki database
+        *   identifier as understood by the LoadBalancer class.
+        * @return string Text the text requested or false on failure
+        */
        public static function getRevisionText( $row, $prefix = 'old_', $wiki = false ) {
                wfProfileIn( __METHOD__ );
 
@@ -1566,9 +1566,10 @@ class Revision implements IDBAccessObject {
         * @param int $pageId: ID number of the page to read from
         * @param string $summary Revision's summary
         * @param bool $minor Whether the revision should be considered as minor
+        * @param User|null $user User object to use or null for $wgUser
         * @return Revision|null Revision or null on error
         */
-       public static function newNullRevision( $dbw, $pageId, $summary, $minor ) {
+       public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
                global $wgContentHandlerUseDB;
 
                wfProfileIn( __METHOD__ );
@@ -1591,8 +1592,15 @@ class Revision implements IDBAccessObject {
                        __METHOD__ );
 
                if ( $current ) {
+                       if ( !$user ) {
+                               global $wgUser;
+                               $user = $wgUser;
+                       }
+
                        $row = array(
                                'page'       => $pageId,
+                               'user_text'  => $user->getName(),
+                               'user'       => $user->getId(),
                                'comment'    => $summary,
                                'minor_edit' => $minor,
                                'text_id'    => $current->rev_text_id,