40 $this->file = static::initFile(
$list,
$row );
41 $this->dbProvider = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
52 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
53 ->newFileFromRow(
$row );
57 return 'oi_archive_name';
61 return 'oi_timestamp';
69 return 'oi_user_text';
77 $parts = explode(
'!', $this->row->oi_archive_name );
83 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
87 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
91 return $this->file->getVisibility();
96 # @todo FIXME: Move to LocalFile.php
98 if ( $bits & File::DELETED_FILE ) {
102 $key = $this->file->getStorageKey();
103 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
104 $this->list->storeBatch[] = [
105 $this->file->repo->getVirtualUrl(
'deleted' ) .
'/' . $srcRel,
107 $this->file->getRel()
109 $this->list->cleanupBatch[] = $key;
111 } elseif ( $bits & File::DELETED_FILE ) {
113 $key = $this->file->getStorageKey();
114 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
115 $this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
118 # Do the database operations
119 $dbw = $this->dbProvider->getPrimaryDatabase();
120 $dbw->newUpdateQueryBuilder()
121 ->update(
'oldimage' )
122 ->set( [
'oi_deleted' => $bits ] )
124 'oi_name' => $this->row->oi_name,
125 'oi_timestamp' => $this->row->oi_timestamp,
126 'oi_deleted' => $this->getBits()
128 ->caller( __METHOD__ )->execute();
130 return (
bool)$dbw->affectedRows();
134 return $this->file->isDeleted( File::DELETED_FILE );
143 $date = $this->list->getLanguage()->userTimeAndDate(
144 $this->file->getTimestamp(), $this->list->getUser() );
148 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
153 $link = htmlspecialchars( $date );
156 SpecialPage::getTitleFor(
'Revisiondelete' ),
160 'target' => $this->list->getPageName(),
161 'file' => $this->file->getArchiveName(),
162 'token' => $this->list->getUser()->getEditToken(
163 $this->file->getArchiveName() )
168 return '<span class="history-deleted">' . $link .
'</span>';
176 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
178 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
179 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
182 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
184 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
185 return '<span class="history-deleted">' . $link .
'</span>';
197 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
198 $block = MediaWikiServices::getInstance()->getCommentFormatter()
199 ->formatBlock( $this->file->getDescription() );
201 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
203 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
204 return "<span class=\"history-deleted\">$block</span>";
212 $this->list->msg(
'widthheight' )->numParams(
213 $this->file->getWidth(),
214 $this->file->getHeight() )->escaped() .
215 ' (' . $this->list->msg(
'nbytes' )->numParams(
216 $this->file->getSize() )->escaped() .
')';
224 $user = $this->list->getUser();
226 'title' => $this->list->getPageName(),
233 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
234 'contenthidden' => (bool)$this->
isDeleted(),
242 'url' => SpecialPage::getTitleFor(
'Revisiondelete' )->getLinkURL(
244 'target' => $this->list->getPageName(),
254 'userid' => $uploader->getId(),
255 'user' => $uploader->getName(),
259 if ( ( $comment ??
'' ) !==
'' ) {
261 'comment' => $comment,
269 return $this->file->acquireFileLock();
273 return $this->file->releaseFileLock();
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.
IConnectionProvider $dbProvider
__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.