* @ingroup RevisionDelete
*/
+use MediaWiki\Storage\RevisionRecord;
+
/**
* Item class for an oldimage table row
*/
public function __construct( $list, $row ) {
parent::__construct( $list, $row );
- $this->file = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
+ $this->file = static::initFile( $list, $row );
+ }
+
+ /**
+ * Create file object from $row sourced from $list
+ *
+ * @param RevDelFileList $list
+ * @param mixed $row
+ * @return mixed
+ */
+ protected static function initFile( $list, $row ) {
+ return RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
}
public function getIdField() {
return 'oi_user_text';
}
+ public function getAuthorActorField() {
+ return 'oi_actor';
+ }
+
public function getId() {
$parts = explode( '!', $this->row->oi_archive_name );
* @return string
*/
protected function getLink() {
- $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
- $this->file->getTimestamp(), $this->list->getUser() ) );
+ $date = $this->list->getLanguage()->userTimeAndDate(
+ $this->file->getTimestamp(), $this->list->getUser() );
if ( !$this->isDeleted() ) {
# Regular files...
- return Html::rawElement( 'a', [ 'href' => $this->file->getUrl() ], $date );
+ return Html::element( 'a', [ 'href' => $this->file->getUrl() ], $date );
}
# Hidden files...
if ( !$this->canViewContent() ) {
- $link = $date;
+ $link = htmlspecialchars( $date );
} else {
- $link = Linker::link(
+ $link = $this->getLinkRenderer()->makeLink(
SpecialPage::getTitleFor( 'Revisiondelete' ),
$date,
[],
* @return string HTML
*/
protected function getUserTools() {
- if ( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) {
+ if ( $this->file->userCan( RevisionRecord::DELETED_USER, $this->list->getUser() ) ) {
$uid = $this->file->getUser( 'id' );
$name = $this->file->getUser( 'text' );
$link = Linker::userLink( $uid, $name ) . Linker::userToolLinks( $uid, $name );
} else {
$link = $this->list->msg( 'rev-deleted-user' )->escaped();
}
- if ( $this->file->isDeleted( Revision::DELETED_USER ) ) {
+ if ( $this->file->isDeleted( RevisionRecord::DELETED_USER ) ) {
return '<span class="history-deleted">' . $link . '</span>';
}
'width' => $file->getWidth(),
'height' => $file->getHeight(),
'size' => $file->getSize(),
+ 'userhidden' => (bool)$file->isDeleted( RevisionRecord::DELETED_USER ),
+ 'commenthidden' => (bool)$file->isDeleted( RevisionRecord::DELETED_COMMENT ),
+ 'contenthidden' => (bool)$this->isDeleted(),
];
- $ret += $file->isDeleted( Revision::DELETED_USER ) ? [ 'userhidden' => '' ] : [];
- $ret += $file->isDeleted( Revision::DELETED_COMMENT ) ? [ 'commenthidden' => '' ] : [];
- $ret += $this->isDeleted() ? [ 'contenthidden' => '' ] : [];
if ( !$this->isDeleted() ) {
$ret += [
'url' => $file->getUrl(),
),
];
}
- if ( $file->userCan( Revision::DELETED_USER, $user ) ) {
+ if ( $file->userCan( RevisionRecord::DELETED_USER, $user ) ) {
$ret += [
'userid' => $file->user,
'user' => $file->user_text,
];
}
- if ( $file->userCan( Revision::DELETED_COMMENT, $user ) ) {
+ if ( $file->userCan( RevisionRecord::DELETED_COMMENT, $user ) ) {
$ret += [
'comment' => $file->description,
];