use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
/**
* List for revision table items for a single page
/** @var ResultWrapper|bool */
protected $res;
- /** @var bool|object */
+ /** @var bool|Revision */
protected $current;
/**
}
public function key() {
- return $this->res ? $this->res->key(): 0;
+ return $this->res ? $this->res->key() : 0;
}
public function valid() {
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
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
*/
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']
);
}