19use Wikimedia\Timestamp\TimestampFormat as TS;
34 $this->file = static::initFile(
$list,
$row );
47 ->newFileFromRow(
$row );
52 return 'oi_archive_name';
57 return 'oi_timestamp';
67 return 'oi_user_text';
77 $parts = explode(
'!', $this->row->oi_archive_name );
84 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
89 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
94 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();
141 return $this->file->isDeleted( File::DELETED_FILE );
150 $date = $this->list->getLanguage()->userTimeAndDate(
151 $this->file->getTimestamp(), $this->list->getUser() );
155 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
160 $link = htmlspecialchars( $date );
167 'target' => $this->list->getPageName(),
168 'file' => $this->file->getArchiveName(),
169 'token' => $this->list->getUser()->getEditToken(
170 $this->file->getArchiveName() )
175 return '<span class="history-deleted">' . $link .
'</span>';
183 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
185 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
186 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
189 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
191 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
192 return '<span class="history-deleted">' . $link .
'</span>';
204 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
206 ->formatBlock( $this->file->getDescription() );
208 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
210 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
211 return "<span class=\"history-deleted\">$block</span>";
220 $this->list->msg(
'widthheight' )->numParams(
221 $this->file->getWidth(),
222 $this->file->getHeight() )->escaped() .
223 ' (' . $this->list->msg(
'nbytes' )->numParams(
224 $this->file->getSize() )->escaped() .
')';
233 $user = $this->list->getUser();
235 'title' => $this->list->getPageName(),
242 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
243 'contenthidden' => (bool)$this->
isDeleted(),
253 'target' => $this->list->getPageName(),
263 'userid' => $uploader->getId(),
264 'user' => $uploader->getName(),
268 if ( ( $comment ??
'' ) !==
'' ) {
270 'comment' => $comment,
279 return $this->file->acquireFileLock();
284 return $this->file->releaseFileLock();
289class_alias( RevDelFileItem::class,
'RevDelFileItem' );
wfTimestamp( $outputtype=TS::UNIX, $ts=0)
Get a timestamp string in one of various formats.
Parent class for all special pages.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...