MediaWiki  master
FileDeleteForm Class Reference

File deletion user interface. More...

Collaboration diagram for FileDeleteForm:

Public Member Functions

 __construct ( $file, User $user, OutputPage $out)
 
 execute ()
 Fulfil the request; shows the form or deletes the file, pending authentication, confirmation, etc. More...
 

Static Public Member Functions

static doDelete (&$title, &$file, &$oldimage, $reason, $suppress, User $user, $tags=[])
 Really delete the file. More...
 
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? More...
 
static isValidOldSpec ( $oldimage)
 Is the provided oldimage value valid? More...
 

Private Member Functions

 getAction ()
 Prepare the form action. More...
 
 getTimestamp ()
 Extract the timestamp of the old version. More...
 
 prepareMessage ( $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. More...
 
 setHeaders ()
 Set headers, titles and other bits. More...
 
 showForm ()
 Show the confirmation form. More...
 
 showLogEntries ()
 Show deletion log fragments pertaining to the current file. More...
 

Private Attributes

LocalFile $file = null
 
LocalFile $oldfile = null
 
string $oldimage = ''
 
OutputPage $out = null
 
Title $title = null
 
User $user = null
 

Detailed Description

File deletion user interface.

Definition at line 31 of file FileDeleteForm.php.

Constructor & Destructor Documentation

◆ __construct()

FileDeleteForm::__construct (   $file,
User  $user,
OutputPage  $out 
)
Parameters
LocalFile$fileFile object we're deleting
User$user
OutputPage$out

Definition at line 56 of file FileDeleteForm.php.

References $file, $out, $user, and File\getTitle().

Member Function Documentation

◆ doDelete()

static FileDeleteForm::doDelete ( $title,
$file,
$oldimage,
  $reason,
  $suppress,
User  $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
User$user
array$tagsTags to apply to the deletion action
Exceptions
MWException
Returns
Status

Definition at line 174 of file FileDeleteForm.php.

References $file, $oldimage, $title, $user, DB_MASTER, LocalFile\deleteFile(), LocalFile\deleteOldFile(), WikiPage\factory(), Title\getPrefixedText(), StatusValue\newFatal(), Hooks\runner(), wfEscapeWikiText(), wfGetDB(), 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 67 of file FileDeleteForm.php.

References $wgRequest, $wgUploadMaintenance, doDelete(), WatchAction\doWatchOrUnwatch(), Title\newMainPage(), prepareMessage(), setHeaders(), showForm(), showLogEntries(), wfMessage(), and wfReadOnly().

◆ getAction()

FileDeleteForm::getAction ( )
private

Prepare the form action.

Returns
string

Definition at line 508 of file FileDeleteForm.php.

References $oldimage.

Referenced by showForm().

◆ getTimestamp()

FileDeleteForm::getTimestamp ( )
private

Extract the timestamp of the old version.

Returns
string

Definition at line 524 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 497 of file FileDeleteForm.php.

References $file, $oldfile, $oldimage, LocalFile\exists(), and File\isLocal().

◆ isValidOldSpec()

static FileDeleteForm::isValidOldSpec (   $oldimage)
static

Is the provided oldimage value valid?

Parameters
string$oldimage
Returns
bool

Definition at line 481 of file FileDeleteForm.php.

References $oldimage.

Referenced by ApiDelete\deleteFile().

◆ prepareMessage()

FileDeleteForm::prepareMessage (   $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 447 of file FileDeleteForm.php.

References $wgLang, PROTO_CURRENT, wfEscapeWikiText(), wfExpandUrl(), and wfMessage().

Referenced by execute(), and showForm().

◆ setHeaders()

FileDeleteForm::setHeaders ( )
private

Set headers, titles and other bits.

Definition at line 469 of file FileDeleteForm.php.

References wfMessage().

Referenced by execute().

◆ showForm()

FileDeleteForm::showForm ( )
private

◆ showLogEntries()

FileDeleteForm::showLogEntries ( )
private

Show deletion log fragments pertaining to the current file.

Definition at line 429 of file FileDeleteForm.php.

References LogEventsList\showLogExtract().

Referenced by execute().

Member Data Documentation

◆ $file

LocalFile FileDeleteForm::$file = null
private

Definition at line 37 of file FileDeleteForm.php.

Referenced by __construct(), doDelete(), and haveDeletableFile().

◆ $oldfile

LocalFile FileDeleteForm::$oldfile = null
private

Definition at line 43 of file FileDeleteForm.php.

Referenced by haveDeletableFile().

◆ $oldimage

string FileDeleteForm::$oldimage = ''
private

Definition at line 46 of file FileDeleteForm.php.

Referenced by doDelete(), getAction(), haveDeletableFile(), and isValidOldSpec().

◆ $out

OutputPage FileDeleteForm::$out = null
private

Definition at line 49 of file FileDeleteForm.php.

Referenced by __construct().

◆ $title

Title FileDeleteForm::$title = null
private

Definition at line 34 of file FileDeleteForm.php.

Referenced by doDelete().

◆ $user

User FileDeleteForm::$user = null
private

Definition at line 40 of file FileDeleteForm.php.

Referenced by __construct(), and doDelete().


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