44 $this->file = static::initFile(
$list,
$row );
45 $this->dbProvider = MediaWikiServices::getInstance()->getConnectionProvider();
56 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
57 ->newFileFromRow(
$row );
61 return 'oi_archive_name';
65 return 'oi_timestamp';
73 return 'oi_user_text';
81 $parts = explode(
'!', $this->row->oi_archive_name );
87 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
91 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
95 return $this->file->getVisibility();
100 # @todo FIXME: Move to LocalFile.php
102 if ( $bits & File::DELETED_FILE ) {
106 $key = $this->file->getStorageKey();
107 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
108 $this->list->storeBatch[] = [
109 $this->file->repo->getVirtualUrl(
'deleted' ) .
'/' . $srcRel,
111 $this->file->getRel()
113 $this->list->cleanupBatch[] = $key;
115 } elseif ( $bits & File::DELETED_FILE ) {
117 $key = $this->file->getStorageKey();
118 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
119 $this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
122 # Do the database operations
123 $dbw = $this->dbProvider->getPrimaryDatabase();
124 $dbw->newUpdateQueryBuilder()
125 ->update(
'oldimage' )
126 ->set( [
'oi_deleted' => $bits ] )
128 'oi_name' => $this->row->oi_name,
129 'oi_timestamp' => $this->row->oi_timestamp,
130 'oi_deleted' => $this->getBits()
132 ->caller( __METHOD__ )->execute();
134 return (
bool)$dbw->affectedRows();
138 return $this->file->isDeleted( File::DELETED_FILE );
147 $date = $this->list->getLanguage()->userTimeAndDate(
148 $this->file->getTimestamp(), $this->list->getUser() );
152 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
157 $link = htmlspecialchars( $date );
160 SpecialPage::getTitleFor(
'Revisiondelete' ),
164 'target' => $this->list->getPageName(),
165 'file' => $this->file->getArchiveName(),
166 'token' => $this->list->getUser()->getEditToken(
167 $this->file->getArchiveName() )
172 return '<span class="history-deleted">' . $link .
'</span>';
180 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
182 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
183 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
186 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
188 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
189 return '<span class="history-deleted">' . $link .
'</span>';
201 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
202 $block = MediaWikiServices::getInstance()->getCommentFormatter()
203 ->formatBlock( $this->file->getDescription() );
205 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
207 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
208 return "<span class=\"history-deleted\">$block</span>";
216 $this->list->msg(
'widthheight' )->numParams(
217 $this->file->getWidth(),
218 $this->file->getHeight() )->escaped() .
219 ' (' . $this->list->msg(
'nbytes' )->numParams(
220 $this->file->getSize() )->escaped() .
')';
228 $user = $this->list->getUser();
230 'title' => $this->list->getPageName(),
237 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
238 'contenthidden' => (bool)$this->
isDeleted(),
246 'url' => SpecialPage::getTitleFor(
'Revisiondelete' )->getLinkURL(
248 'target' => $this->list->getPageName(),
258 'userid' => $uploader->getId(),
259 'user' => $uploader->getName(),
263 if ( ( $comment ??
'' ) !==
'' ) {
265 'comment' => $comment,
273 return $this->file->acquireFileLock();
277 return $this->file->releaseFileLock();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Parent class for all special pages.
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.