Update ImportableUploadRevisionImporter for interwiki usernames
[lhc/web/wiklou.git] / includes / RevisionList.php
index ccdedb8..5243cc6 100644 (file)
@@ -116,7 +116,7 @@ abstract class RevisionListBase extends ContextSource implements Iterator {
        }
 
        public function key() {
-               return $this->res ? $this->res->key(): 0;
+               return $this->res ? $this->res->key() : 0;
        }
 
        public function valid() {
@@ -203,6 +203,16 @@ abstract class RevisionItemBase {
                return false;
        }
 
+       /**
+        * Get the DB field name storing actor ids.
+        * Override this function.
+        * @since 1.31
+        * @return bool
+        */
+       public function getAuthorActorField() {
+               return false;
+       }
+
        /**
         * Get the ID, as it would appear in the ids URL parameter
         * @return int
@@ -257,6 +267,16 @@ abstract class RevisionItemBase {
                return strval( $this->row->$field );
        }
 
+       /**
+        * Get the author actor ID
+        * @since 1.31
+        * @return string
+        */
+       public function getAuthorActor() {
+               $field = $this->getAuthorActorField();
+               return strval( $this->row->$field );
+       }
+
        /**
         * Returns true if the current user can view the item
         */
@@ -296,15 +316,14 @@ class RevisionList extends RevisionListBase {
                if ( $this->ids !== null ) {
                        $conds['rev_id'] = array_map( 'intval', $this->ids );
                }
+               $revQuery = Revision::getQueryInfo( [ 'page', 'user' ] );
                return $db->select(
-                       [ 'revision', 'page', 'user' ],
-                       array_merge( Revision::selectFields(), Revision::selectUserFields() ),
+                       $revQuery['tables'],
+                       $revQuery['fields'],
                        $conds,
                        __METHOD__,
                        [ 'ORDER BY' => 'rev_id DESC' ],
-                       [
-                               'page' => Revision::pageJoinCond(),
-                               'user' => Revision::userJoinCond() ]
+                       $revQuery['joins']
                );
        }