42 $this->file = static::initFile(
$list,
$row );
43 $this->dbProvider = MediaWikiServices::getInstance()->getConnectionProvider();
54 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
55 ->newFileFromRow(
$row );
59 return 'oi_archive_name';
63 return 'oi_timestamp';
71 return 'oi_user_text';
79 $parts = explode(
'!', $this->row->oi_archive_name );
85 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
89 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
93 return $this->file->getVisibility();
98 # @todo FIXME: Move to LocalFile.php
100 if ( $bits & File::DELETED_FILE ) {
104 $key = $this->file->getStorageKey();
105 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
106 $this->list->storeBatch[] = [
107 $this->file->repo->getVirtualUrl(
'deleted' ) .
'/' . $srcRel,
109 $this->file->getRel()
111 $this->list->cleanupBatch[] = $key;
113 } elseif ( $bits & File::DELETED_FILE ) {
115 $key = $this->file->getStorageKey();
116 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
117 $this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
120 # Do the database operations
121 $dbw = $this->dbProvider->getPrimaryDatabase();
122 $dbw->newUpdateQueryBuilder()
123 ->update(
'oldimage' )
124 ->set( [
'oi_deleted' => $bits ] )
126 'oi_name' => $this->row->oi_name,
127 'oi_timestamp' => $this->row->oi_timestamp,
128 'oi_deleted' => $this->getBits()
130 ->caller( __METHOD__ )->execute();
132 return (
bool)$dbw->affectedRows();
136 return $this->file->isDeleted( File::DELETED_FILE );
145 $date = $this->list->getLanguage()->userTimeAndDate(
146 $this->file->getTimestamp(), $this->list->getUser() );
150 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
155 $link = htmlspecialchars( $date );
158 SpecialPage::getTitleFor(
'Revisiondelete' ),
162 'target' => $this->list->getPageName(),
163 'file' => $this->file->getArchiveName(),
164 'token' => $this->list->getUser()->getEditToken(
165 $this->file->getArchiveName() )
170 return '<span class="history-deleted">' . $link .
'</span>';
178 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
180 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
181 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
184 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
186 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
187 return '<span class="history-deleted">' . $link .
'</span>';
199 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
200 $block = MediaWikiServices::getInstance()->getCommentFormatter()
201 ->formatBlock( $this->file->getDescription() );
203 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
205 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
206 return "<span class=\"history-deleted\">$block</span>";
214 $this->list->msg(
'widthheight' )->numParams(
215 $this->file->getWidth(),
216 $this->file->getHeight() )->escaped() .
217 ' (' . $this->list->msg(
'nbytes' )->numParams(
218 $this->file->getSize() )->escaped() .
')';
226 $user = $this->list->getUser();
228 'title' => $this->list->getPageName(),
235 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
236 'contenthidden' => (bool)$this->
isDeleted(),
244 'url' => SpecialPage::getTitleFor(
'Revisiondelete' )->getLinkURL(
246 'target' => $this->list->getPageName(),
256 'userid' => $uploader->getId(),
257 'user' => $uploader->getName(),
261 if ( ( $comment ??
'' ) !==
'' ) {
263 'comment' => $comment,
271 return $this->file->acquireFileLock();
275 return $this->file->releaseFileLock();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getUrl()
Return the URL of the file.
getWidth( $page=1)
Return the width of the image.
getSize()
Returns the size of the image file, in bytes.
getHeight( $page=1)
Return the height of the image.
getDescription( $audience=self::FOR_PUBLIC, ?Authority $performer=null)
getUploader(int $audience=self::FOR_PUBLIC, ?Authority $performer=null)
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.