38 $this->file = static::initFile(
$list,
$row );
49 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
50 ->newFileFromRow(
$row );
54 return 'oi_archive_name';
58 return 'oi_timestamp';
66 return 'oi_user_text';
74 $parts = explode(
'!', $this->row->oi_archive_name );
80 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
84 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
88 return $this->file->getVisibility();
93 # @todo FIXME: Move to LocalFile.php
95 if ( $bits & File::DELETED_FILE ) {
99 $key = $this->file->getStorageKey();
100 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
101 $this->list->storeBatch[] = [
102 $this->file->repo->getVirtualUrl(
'deleted' ) .
'/' . $srcRel,
104 $this->file->getRel()
106 $this->list->cleanupBatch[] = $key;
108 } elseif ( $bits & File::DELETED_FILE ) {
110 $key = $this->file->getStorageKey();
111 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
112 $this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
115 # Do the database operations
117 $dbw->newUpdateQueryBuilder()
118 ->update(
'oldimage' )
119 ->set( [
'oi_deleted' => $bits ] )
121 'oi_name' => $this->row->oi_name,
122 'oi_timestamp' => $this->row->oi_timestamp,
123 'oi_deleted' => $this->getBits()
125 ->caller( __METHOD__ )->execute();
127 return (
bool)$dbw->affectedRows();
131 return $this->file->isDeleted( File::DELETED_FILE );
140 $date = $this->list->getLanguage()->userTimeAndDate(
141 $this->file->getTimestamp(), $this->list->getUser() );
145 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
150 $link = htmlspecialchars( $date );
153 SpecialPage::getTitleFor(
'Revisiondelete' ),
157 'target' => $this->list->getPageName(),
158 'file' => $this->file->getArchiveName(),
159 'token' => $this->list->getUser()->getEditToken(
160 $this->file->getArchiveName() )
165 return '<span class="history-deleted">' . $link .
'</span>';
173 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
175 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
176 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
179 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
181 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
182 return '<span class="history-deleted">' . $link .
'</span>';
194 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
195 $block = MediaWikiServices::getInstance()->getCommentFormatter()
196 ->formatBlock( $this->file->getDescription() );
198 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
200 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
201 return "<span class=\"history-deleted\">$block</span>";
209 $this->list->msg(
'widthheight' )->numParams(
210 $this->file->getWidth(),
211 $this->file->getHeight() )->escaped() .
212 ' (' . $this->list->msg(
'nbytes' )->numParams(
213 $this->file->getSize() )->escaped() .
')';
221 $user = $this->list->getUser();
223 'title' => $this->list->getPageName(),
230 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
231 'contenthidden' => (bool)$this->
isDeleted(),
239 'url' => SpecialPage::getTitleFor(
'Revisiondelete' )->getLinkURL(
241 'target' => $this->list->getPageName(),
251 'userid' => $uploader->getId(),
252 'user' => $uploader->getName(),
256 if ( ( $comment ??
'' ) !==
'' ) {
258 'comment' => $comment,
266 return $this->file->acquireFileLock();
270 return $this->file->releaseFileLock();
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
This class represents the result of the API operations.
getUrl()
Return the URL of the file.
getWidth( $page=1)
Return the width of the image.
getUploader(int $audience=self::FOR_PUBLIC, Authority $performer=null)
getSize()
Returns the size of the image file, in bytes.
getDescription( $audience=self::FOR_PUBLIC, Authority $performer=null)
getHeight( $page=1)
Return the height of the image.
Parent class for all special pages.
Old file in the oldimage table.
Item class for an oldimage table row.
getTimestampField()
Get the DB field name storing timestamps.
getComment()
Wrap and format the file's comment block, if the current user is allowed to view it.
getLink()
Get the link to the file.
canViewContent()
Returns true if the current user can view the item text/file.
getId()
Get the ID, as it would appear in the ids URL parameter.
getIdField()
Get the DB field name associated with the ID list.
getBits()
Get the current deletion bitfield value.
getAuthorIdField()
Get the DB field name storing user ids.
static initFile( $list, $row)
Create file object from $row sourced from $list.
getHTML()
Get the HTML of the list item.
getUserTools()
Generate a user tool link cluster if the current user is allowed to view it.
__construct(RevisionListBase $list, $row)
unlock()
Unlock the item against changes outside of the DB.
getAuthorNameField()
Get the DB field name storing user names.
lock()
Lock the item against changes outside of the DB.
canView()
Returns true if the current user can view the item.
getAuthorActorField()
Get the DB field name storing actor ids.
setBits( $bits)
Set the visibility of the item.
getApiData(ApiResult $result)
Get the return information about the revision for the API.
List for oldimage table items.
Abstract base class for deletable items.
stdClass $row
The database result row.
getLinkRenderer()
Returns an instance of LinkRenderer.
List for revision table items for a single page.