20use Wikimedia\Timestamp\TimestampFormat as TS;
35 $this->file = static::initFile(
$list,
$row );
48 ->newFileFromRow(
$row );
53 return 'oi_archive_name';
58 return 'oi_timestamp';
68 return 'oi_user_text';
78 $parts = explode(
'!', $this->row->oi_archive_name );
85 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getAuthority() );
90 return $this->file->userCan( File::DELETED_FILE, $this->list->getAuthority() );
95 return $this->file->getVisibility();
101 # @todo FIXME: Move to LocalFile.php
103 if ( $bits & File::DELETED_FILE ) {
107 $key = $this->file->getStorageKey();
108 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
109 $this->list->storeBatch[] = [
110 $this->file->repo->getVirtualUrl(
'deleted' ) .
'/' . $srcRel,
112 $this->file->getRel()
114 $this->list->cleanupBatch[] = $key;
116 } elseif ( $bits & File::DELETED_FILE ) {
118 $key = $this->file->getStorageKey();
119 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
120 $this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
124 $dbw = $this->dbProvider->getPrimaryDatabase();
129 $dbw->newUpdateQueryBuilder()
130 ->update(
'oldimage' )
131 ->set( [
'oi_deleted' => $bits ] )
133 'oi_name' => $this->row->oi_name,
134 'oi_timestamp' => $this->row->oi_timestamp,
135 'oi_deleted' => $this->getBits()
137 ->caller( __METHOD__ )->execute();
140 $dbw->newUpdateQueryBuilder()
141 ->update(
'filerevision' )
142 ->set( [
'fr_deleted' => $bits ] )
144 'fr_file' => $this->file->getFileIdFromName(),
145 'fr_timestamp' => $this->row->oi_timestamp,
146 'fr_deleted' => $this->getBits()
148 ->caller( __METHOD__ )->execute();
151 return (
bool)$dbw->affectedRows();
158 return $this->file->isDeleted( File::DELETED_FILE );
167 $date = $this->list->getLanguage()->userTimeAndDate(
168 $this->file->getTimestamp(), $this->list->getUser() );
172 return Html::element(
'a', [
'href' => $this->file->getUrl() ], $date );
177 $link = htmlspecialchars( $date );
184 'target' => $this->list->getPageName(),
185 'file' => $this->file->getArchiveName(),
186 'token' => $this->list->getUser()->getEditToken(
187 $this->file->getArchiveName() )
192 return '<span class="history-deleted">' . $link .
'</span>';
200 $uploader = $this->file->getUploader( File::FOR_THIS_USER, $this->list->getAuthority() );
202 $link = Linker::userLink( $uploader->getId(), $uploader->getName() ) .
203 Linker::userToolLinks( $uploader->getId(), $uploader->getName() );
206 $link = $this->list->msg(
'rev-deleted-user' )->escaped();
208 if ( $this->file->isDeleted( File::DELETED_USER ) ) {
209 return '<span class="history-deleted">' . $link .
'</span>';
221 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getAuthority() ) ) {
223 ->formatBlock( $this->file->getDescription() );
225 $block =
' ' . $this->list->msg(
'rev-deleted-comment' )->escaped();
227 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
228 return "<span class=\"history-deleted\">$block</span>";
237 $this->list->msg(
'widthheight' )->numParams(
238 $this->file->getWidth(),
239 $this->file->getHeight() )->escaped() .
240 ' (' . $this->list->msg(
'nbytes' )->numParams(
241 $this->file->getSize() )->escaped() .
')';
250 $user = $this->list->getUser();
252 'title' => $this->list->getPageName(),
259 'commenthidden' => (bool)
$file->
isDeleted( File::DELETED_COMMENT ),
260 'contenthidden' => (bool)$this->
isDeleted(),
270 'target' => $this->list->getPageName(),
280 'userid' => $uploader->getId(),
281 'user' => $uploader->getName(),
285 if ( ( $comment ??
'' ) !==
'' ) {
287 'comment' => $comment,
296 return $this->file->acquireFileLock();
301 return $this->file->releaseFileLock();
306class_alias( RevDelFileItem::class,
'RevDelFileItem' );
const SCHEMA_COMPAT_WRITE_OLD
const SCHEMA_COMPAT_WRITE_NEW
wfTimestamp( $outputtype=TS::UNIX, $ts=0)
Get a timestamp string in one of various formats.
A class containing constants representing the names of configuration variables.
const FileSchemaMigrationStage
Name constant for the FileSchemaMigrationStage setting, for use with Config::get()
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,...