MediaWiki REL1_37
FileDeleteForm Class Reference

File deletion user interface. More...

Collaboration diagram for FileDeleteForm:

Public Member Functions

 __construct (LocalFile $file, IContextSource $context, ReadOnlyMode $readOnlyMode, RepoGroup $repoGroup, WatchlistManager $watchlistManager, LinkRenderer $linkRenderer, UserOptionsLookup $userOptionsLookup)
 
 execute ()
 Fulfil the request; shows the form or deletes the file, pending authentication, confirmation, etc.
 

Static Public Member Functions

static doDelete (&$title, &$file, &$oldimage, $reason, $suppress, UserIdentity $user, $tags=[])
 Really delete the file.
 
static haveDeletableFile (&$file, &$oldfile, $oldimage)
 Could we delete the file specified? If an oldimage value was provided, does it correspond to an existing, local, old version of this file?
 
static isValidOldSpec ( $oldimage)
 Is the provided oldimage value valid?
 

Private Member Functions

 getAction ()
 Prepare the form action.
 
 getTimestamp ()
 Extract the timestamp of the old version.
 
 prepareMessage (string $message)
 Prepare a message referring to the file being deleted, showing an appropriate message depending upon whether it's a current file or an old version.
 
 setHeaders ()
 Set headers, titles and other bits.
 
 showForm ()
 Show the confirmation form.
 
 showLogEntries ()
 Show deletion log fragments pertaining to the current file.
 

Private Attributes

IContextSource $context
 
LocalFile $file
 
LinkRenderer $linkRenderer
 
LocalFile null $oldfile = null
 
string $oldimage = ''
 
ReadOnlyMode $readOnlyMode
 
RepoGroup $repoGroup
 
Title $title
 
UserOptionsLookup $userOptionsLookup
 
WatchlistManager $watchlistManager
 

Detailed Description

File deletion user interface.

Definition at line 37 of file FileDeleteForm.php.

Constructor & Destructor Documentation

◆ __construct()

FileDeleteForm::__construct ( LocalFile  $file,
IContextSource  $context,
ReadOnlyMode  $readOnlyMode,
RepoGroup  $repoGroup,
WatchlistManager  $watchlistManager,
LinkRenderer  $linkRenderer,
UserOptionsLookup  $userOptionsLookup 
)
Parameters
LocalFile$fileFile object we're deleting
IContextSource$context
ReadOnlyMode$readOnlyMode
RepoGroup$repoGroup
WatchlistManager$watchlistManager
LinkRenderer$linkRenderer
UserOptionsLookup$userOptionsLookup

Definition at line 78 of file FileDeleteForm.php.

References $context, $file, $linkRenderer, $readOnlyMode, $repoGroup, $userOptionsLookup, $watchlistManager, and File\getTitle().

Member Function Documentation

◆ doDelete()

static FileDeleteForm::doDelete ( $title,
$file,
$oldimage,
  $reason,
  $suppress,
UserIdentity  $user,
  $tags = [] 
)
static

Really delete the file.

Parameters
Title&$title
LocalFile&$file
?string&$oldimage Archive name
string$reasonReason of the deletion
bool$suppressWhether to mark all deleted versions as restricted
UserIdentity$user
string[]$tagsTags to apply to the deletion action
Exceptions
MWException
Returns
Status

Definition at line 207 of file FileDeleteForm.php.

References $file, $oldimage, $title, LocalFile\deleteOldFile(), and wfMessage().

Referenced by ApiDelete\deleteFile(), and execute().

◆ execute()

FileDeleteForm::execute ( )

Fulfil the request; shows the form or deletes the file, pending authentication, confirmation, etc.

Definition at line 101 of file FileDeleteForm.php.

References $title, doDelete(), prepareMessage(), setHeaders(), showForm(), and showLogEntries().

◆ getAction()

FileDeleteForm::getAction ( )
private

Prepare the form action.

Returns
string

Definition at line 552 of file FileDeleteForm.php.

◆ getTimestamp()

FileDeleteForm::getTimestamp ( )
private

Extract the timestamp of the old version.

Returns
string

Definition at line 568 of file FileDeleteForm.php.

◆ haveDeletableFile()

static FileDeleteForm::haveDeletableFile ( $file,
$oldfile,
  $oldimage 
)
static

Could we delete the file specified? If an oldimage value was provided, does it correspond to an existing, local, old version of this file?

Parameters
LocalFile&$file
LocalFile&$oldfile
string$oldimage
Returns
bool

Definition at line 541 of file FileDeleteForm.php.

References $file.

◆ isValidOldSpec()

static FileDeleteForm::isValidOldSpec (   $oldimage)
static

Is the provided oldimage value valid?

Parameters
string$oldimage
Returns
bool

Definition at line 525 of file FileDeleteForm.php.

Referenced by ApiDelete\deleteFile().

◆ prepareMessage()

FileDeleteForm::prepareMessage ( string  $message)
private

Prepare a message referring to the file being deleted, showing an appropriate message depending upon whether it's a current file or an old version.

Parameters
string$messageMessage base
Returns
string

Definition at line 490 of file FileDeleteForm.php.

References $lang, PROTO_CURRENT, wfEscapeWikiText(), and wfExpandUrl().

Referenced by execute().

◆ setHeaders()

FileDeleteForm::setHeaders ( )
private

Set headers, titles and other bits.

Definition at line 513 of file FileDeleteForm.php.

Referenced by execute().

◆ showForm()

FileDeleteForm::showForm ( )
private

Show the confirmation form.

Definition at line 302 of file FileDeleteForm.php.

Referenced by execute().

◆ showLogEntries()

FileDeleteForm::showLogEntries ( )
private

Show deletion log fragments pertaining to the current file.

Definition at line 474 of file FileDeleteForm.php.

Referenced by execute().

Member Data Documentation

◆ $context

IContextSource FileDeleteForm::$context
private

Definition at line 52 of file FileDeleteForm.php.

Referenced by __construct().

◆ $file

LocalFile FileDeleteForm::$file
private

Definition at line 43 of file FileDeleteForm.php.

Referenced by __construct(), and doDelete().

◆ $linkRenderer

LinkRenderer FileDeleteForm::$linkRenderer
private

Definition at line 64 of file FileDeleteForm.php.

Referenced by __construct().

◆ $oldfile

LocalFile null FileDeleteForm::$oldfile = null
private

Definition at line 46 of file FileDeleteForm.php.

◆ $oldimage

string FileDeleteForm::$oldimage = ''
private

Definition at line 49 of file FileDeleteForm.php.

Referenced by doDelete().

◆ $readOnlyMode

ReadOnlyMode FileDeleteForm::$readOnlyMode
private

Definition at line 55 of file FileDeleteForm.php.

Referenced by __construct().

◆ $repoGroup

RepoGroup FileDeleteForm::$repoGroup
private

Definition at line 58 of file FileDeleteForm.php.

Referenced by __construct().

◆ $title

Title FileDeleteForm::$title
private

Definition at line 40 of file FileDeleteForm.php.

Referenced by doDelete(), and execute().

◆ $userOptionsLookup

UserOptionsLookup FileDeleteForm::$userOptionsLookup
private

Definition at line 67 of file FileDeleteForm.php.

Referenced by __construct().

◆ $watchlistManager

WatchlistManager FileDeleteForm::$watchlistManager
private

Definition at line 61 of file FileDeleteForm.php.

Referenced by __construct().


The documentation for this class was generated from the following file: