revisionRecord = MediaWikiServices::getInstance() ->getRevisionFactory() ->newRevisionFromRow( $row ); $this->context = $list->getContext(); } /** * Get the RevisionRecord for the item * * @return RevisionRecord */ protected function getRevisionRecord() : RevisionRecord { return $this->revisionRecord; } public function getIdField() { return 'rev_id'; } public function getTimestampField() { return 'rev_timestamp'; } public function getAuthorIdField() { return 'rev_user'; } public function getAuthorNameField() { return 'rev_user_text'; } public function canView() { return RevisionRecord::userCanBitfield( $this->getRevisionRecord()->getVisibility(), RevisionRecord::DELETED_RESTRICTED, $this->context->getUser() ); } public function canViewContent() { return RevisionRecord::userCanBitfield( $this->getRevisionRecord()->getVisibility(), RevisionRecord::DELETED_TEXT, $this->context->getUser() ); } public function isDeleted() { return $this->getRevisionRecord()->isDeleted( RevisionRecord::DELETED_TEXT ); } /** * Get the HTML link to the revision text. * @todo Essentially a copy of RevDelRevisionItem::getRevisionLink. That class * should inherit from this one, and implement an appropriate interface instead * of extending RevDelItem * @return string */ protected function getRevisionLink() { $revRecord = $this->getRevisionRecord(); $date = $this->list->getLanguage()->userTimeAndDate( $revRecord->getTimestamp(), $this->list->getUser() ); if ( $this->isDeleted() && !$this->canViewContent() ) { return htmlspecialchars( $date ); } $linkRenderer = $this->getLinkRenderer(); return $linkRenderer->makeKnownLink( $this->list->title, $date, [], [ 'oldid' => $revRecord->getId(), 'unhide' => 1 ] ); } /** * Get the HTML link to the diff. * @todo Essentially a copy of RevDelRevisionItem::getDiffLink. That class * should inherit from this one, and implement an appropriate interface instead * of extending RevDelItem * @return string */ protected function getDiffLink() { if ( $this->isDeleted() && !$this->canViewContent() ) { return $this->context->msg( 'diff' )->escaped(); } else { $linkRenderer = $this->getLinkRenderer(); return $linkRenderer->makeKnownLink( $this->list->title, $this->list->msg( 'diff' )->text(), [], [ 'diff' => $this->getRevisionRecord()->getId(), 'oldid' => 'prev', 'unhide' => 1 ] ); } } /** * @todo Essentially a copy of RevDelRevisionItem::getHTML. That class * should inherit from this one, and implement an appropriate interface instead * of extending RevDelItem * @return string */ public function getHTML() { $difflink = $this->context->msg( 'parentheses' ) ->rawParams( $this->getDiffLink() )->escaped(); $revlink = $this->getRevisionLink(); $userlink = Linker::revUserLink( $this->getRevisionRecord() ); $comment = Linker::revComment( $this->getRevisionRecord() ); if ( $this->isDeleted() ) { $revlink = "$revlink"; } return "