X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FRevisionList.php;h=5243cc65dd355b3b4b9501e24fb67126a45336fa;hb=417dd31ad26be38211ebedea21cd9fcff1affa9b;hp=d909a652d7f0e03c66c0b0f5737aeaa4ad9003f1;hpb=cbac334f116c6546c422a67ce99d2a56eb792d30;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/RevisionList.php b/includes/RevisionList.php index d909a652d7..5243cc65dd 100644 --- a/includes/RevisionList.php +++ b/includes/RevisionList.php @@ -22,6 +22,7 @@ use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\ResultWrapper; +use Wikimedia\Rdbms\IDatabase; /** * List for revision table items for a single page @@ -36,7 +37,7 @@ abstract class RevisionListBase extends ContextSource implements Iterator { /** @var ResultWrapper|bool */ protected $res; - /** @var bool|object */ + /** @var bool|Revision */ protected $current; /** @@ -115,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() { @@ -202,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 @@ -256,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 */ @@ -295,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'] ); }