31 $this->file = static::initFile(
$list,
$row );
32 $this->dbProvider = MediaWikiServices::getInstance()->getConnectionProvider();
43 return MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
44 ->newFileFromRow(
$row );
49 return 'oi_archive_name';
54 return 'oi_timestamp';
64 return 'oi_user_text';
74 $parts = explode(
'!', $this->row->oi_archive_name );
81 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
86 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
91 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();
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>";
217 $this->list->msg(
'widthheight' )->numParams(
218 $this->file->getWidth(),
219 $this->file->getHeight() )->escaped() .
220 ' (' . $this->list->msg(
'nbytes' )->numParams(
221 $this->file->getSize() )->escaped() .
')';
230 $user = $this->list->getUser();
232 'title' => $this->list->getPageName(),
239 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
240 'contenthidden' => (bool)$this->
isDeleted(),
248 'url' => SpecialPage::getTitleFor(
'Revisiondelete' )->getLinkURL(
250 'target' => $this->list->getPageName(),
260 'userid' => $uploader->getId(),
261 'user' => $uploader->getName(),
265 if ( ( $comment ??
'' ) !==
'' ) {
267 'comment' => $comment,
276 return $this->file->acquireFileLock();
281 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.Override this function. string|false
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.bool
getId()
Get the ID, as it would appear in the ids URL parameter.int|string
getIdField()
Get the DB field name associated with the ID list.Override this function. string|null
getBits()
Get the current deletion bitfield value.int
getAuthorIdField()
Get the DB field name storing user ids.Override this function. string|false
static initFile( $list, $row)
Create file object from $row sourced from $list.
getHTML()
Get the HTML of the list item.Should be include "<li></li>" tags. This is used to show the list in HT...
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.Status 1.28
getAuthorNameField()
Get the DB field name storing user names.Override this function. string|false
lock()
Lock the item against changes outside of the DB.Status 1.28
canView()
Returns true if the current user can view the item.bool
getAuthorActorField()
Get the DB field name storing actor ids.Override this function. 1.31 string|false
setBits( $bits)
Set the visibility of the item.This should do any necessary DB queries.The DB update query should hav...
getApiData(ApiResult $result)
Get the return information about the revision for the API.1.23 array Data for the API result
List for oldimage table items.
Abstract base class for deletable items.