41 $this->file = static::initFile(
$list,
$row );
42 $this->dbProvider = MediaWikiServices::getInstance()->getConnectionProvider();
53 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
54 ->newFileFromRow(
$row );
58 return 'oi_archive_name';
62 return 'oi_timestamp';
70 return 'oi_user_text';
78 $parts = explode(
'!', $this->row->oi_archive_name );
84 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
88 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
92 return $this->file->getVisibility();
97 # @todo FIXME: Move to LocalFile.php
99 if ( $bits & File::DELETED_FILE ) {
103 $key = $this->file->getStorageKey();
104 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
105 $this->list->storeBatch[] = [
106 $this->file->repo->getVirtualUrl(
'deleted' ) .
'/' . $srcRel,
108 $this->file->getRel()
110 $this->list->cleanupBatch[] = $key;
112 } elseif ( $bits & File::DELETED_FILE ) {
114 $key = $this->file->getStorageKey();
115 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
116 $this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
119 # Do the database operations
120 $dbw = $this->dbProvider->getPrimaryDatabase();
121 $dbw->newUpdateQueryBuilder()
122 ->update(
'oldimage' )
123 ->set( [
'oi_deleted' => $bits ] )
125 'oi_name' => $this->row->oi_name,
126 'oi_timestamp' => $this->row->oi_timestamp,
127 'oi_deleted' => $this->getBits()
129 ->caller( __METHOD__ )->execute();
131 return (
bool)$dbw->affectedRows();
135 return $this->file->isDeleted( File::DELETED_FILE );
144 $date = $this->list->getLanguage()->userTimeAndDate(
145 $this->file->getTimestamp(), $this->list->getUser() );
149 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
154 $link = htmlspecialchars( $date );
157 SpecialPage::getTitleFor(
'Revisiondelete' ),
161 'target' => $this->list->getPageName(),
162 'file' => $this->file->getArchiveName(),
163 'token' => $this->list->getUser()->getEditToken(
164 $this->file->getArchiveName() )
169 return '<span class="history-deleted">' . $link .
'</span>';
177 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
179 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
180 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
183 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
185 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
186 return '<span class="history-deleted">' . $link .
'</span>';
198 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
199 $block = MediaWikiServices::getInstance()->getCommentFormatter()
200 ->formatBlock( $this->file->getDescription() );
202 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
204 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
205 return "<span class=\"history-deleted\">$block</span>";
213 $this->list->msg(
'widthheight' )->numParams(
214 $this->file->getWidth(),
215 $this->file->getHeight() )->escaped() .
216 ' (' . $this->list->msg(
'nbytes' )->numParams(
217 $this->file->getSize() )->escaped() .
')';
225 $user = $this->list->getUser();
227 'title' => $this->list->getPageName(),
234 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
235 'contenthidden' => (bool)$this->
isDeleted(),
243 'url' => SpecialPage::getTitleFor(
'Revisiondelete' )->getLinkURL(
245 'target' => $this->list->getPageName(),
255 'userid' => $uploader->getId(),
256 'user' => $uploader->getName(),
260 if ( ( $comment ??
'' ) !==
'' ) {
262 'comment' => $comment,
270 return $this->file->acquireFileLock();
274 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.