MediaWiki  REL1_22
SpecialUpload Class Reference

Form for handling uploads and special page. More...

Inheritance diagram for SpecialUpload:
Collaboration diagram for SpecialUpload:

List of all members.

Public Member Functions

 __construct ($request=null)
 Constructor : initialise object Get data POSTed through the form and assign them to the object.
 execute ($par)
 Special page entry point.
 getDupeWarning ($dupes)
 Construct a warning and a gallery from an array of duplicate files.
 userCanExecute (User $user)
 This page can be shown if uploading is enabled.

Static Public Member Functions

static getExistsWarning ($exists)
 Formats a result of UploadBase::getExistsWarning as HTML This check is static and can be done pre-upload via AJAX.
static getInitialPageText ($comment= '', $license= '', $copyStatus= '', $source= '')
 Get the initial image page text based on a comment and optional file status information.

Public Attributes

 $mCancelUpload
 $mComment
 $mCopyrightSource
 $mCopyrightStatus
 $mDesiredDestName
 User input variables from the "description" section.
 $mDestWarningAck
 Hidden variables.
 $mForReUpload
 $mIgnoreWarning
 User input variables from the root section.
 $mLicense
LocalFile $mLocalFile
 $mRequest
 Misc variables.
 $mSourceType
 $mTokenOk
UploadBase $mUpload
 $mUploadClicked
 $mUploadSuccessful = false
 $mWatchThis
 $mWatchthis
 $uploadFormTextAfterSummary
 $uploadFormTextTop
 Text injection points for hooks not using HTMLForm.

Protected Member Functions

 getGroupName ()
 Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-group-*' for valid names This method defaults to group 'other'.
 getUploadForm ($message= '', $sessionKey= '', $hideIgnoreWarning=false)
 Get an UploadForm instance with title and text properly set.
 getWatchCheck ()
 See if we should check the 'watch this page' checkbox on the form based on the user's preferences and whether we're being asked to create a new file or update an existing one.
 loadRequest ()
 Initialize instance variables from request and create an Upload handler.
 processUpload ()
 Do the upload.
 processVerificationError ($details)
 Provides output to the user for a result of UploadBase::verifyUpload.
 showRecoverableUploadError ($message)
 Stashes the upload and shows the main upload form.
 showUploadError ($message)
 Show the upload form with error message, but do not stash the file.
 showUploadForm ($form)
 Show the main upload form.
 showUploadWarning ($warnings)
 Stashes the upload, shows the main form, but adds a "continue anyway button".
 showViewDeletedLinks ()
 Shows the "view X deleted revivions link"".
 unsaveUploadedFile ()
 Remove a temporarily kept file stashed by saveTempUploadedFile().

Detailed Description

Form for handling uploads and special page.

Definition at line 31 of file SpecialUpload.php.


Constructor & Destructor Documentation

SpecialUpload::__construct ( request = null)

Constructor : initialise object Get data POSTed through the form and assign them to the object.

Parameters:
$requestWebRequest : data posted.

Definition at line 37 of file SpecialUpload.php.


Member Function Documentation

Special page entry point.

Reimplemented from SpecialPage.

Definition at line 138 of file SpecialUpload.php.

Construct a warning and a gallery from an array of duplicate files.

Parameters:
$dupesarray
Returns:
string

Definition at line 687 of file SpecialUpload.php.

static SpecialUpload::getExistsWarning ( exists) [static]

Formats a result of UploadBase::getExistsWarning as HTML This check is static and can be done pre-upload via AJAX.

Parameters:
array$existsthe result of UploadBase::getExistsWarning
Returns:
String: empty string if there is no warning or an HTML fragment

Definition at line 635 of file SpecialUpload.php.

Referenced by ApiQueryImageInfo\getInfo().

SpecialUpload::getGroupName ( ) [protected]

Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-group-*' for valid names This method defaults to group 'other'.

Returns:
string
Since:
1.21

Reimplemented from SpecialPage.

Definition at line 703 of file SpecialUpload.php.

static SpecialUpload::getInitialPageText ( comment = '',
license = '',
copyStatus = '',
source = '' 
) [static]

Get the initial image page text based on a comment and optional file status information.

Parameters:
$commentstring
$licensestring
$copyStatusstring
$sourcestring
Returns:
string

Definition at line 463 of file SpecialUpload.php.

SpecialUpload::getUploadForm ( message = '',
sessionKey = '',
hideIgnoreWarning = false 
) [protected]

Get an UploadForm instance with title and text properly set.

Parameters:
string$messageHTML string to add to the form
string$sessionKeysession key in case this is a stashed upload
$hideIgnoreWarningBoolean: whether to hide "ignore warning" check box
Returns:
UploadForm

Definition at line 220 of file SpecialUpload.php.

See if we should check the 'watch this page' checkbox on the form based on the user's preferences and whether we're being asked to create a new file or update an existing one.

In the case where 'watch edits' is off but 'watch creations' is on, we'll leave the box unchecked.

Note that the page target can be changed *on the form*, so our check state can get out of sync.

Returns:
Bool|String

Definition at line 512 of file SpecialUpload.php.

SpecialUpload::loadRequest ( ) [protected]

Initialize instance variables from request and create an Upload handler.

Definition at line 81 of file SpecialUpload.php.

Do the upload.

Checks are made in SpecialUpload::execute()

Definition at line 393 of file SpecialUpload.php.

SpecialUpload::processVerificationError ( details) [protected]

Provides output to the user for a result of UploadBase::verifyUpload.

Parameters:
array$detailsresult of UploadBase::verifyUpload
Exceptions:
MWException

Definition at line 535 of file SpecialUpload.php.

SpecialUpload::showRecoverableUploadError ( message) [protected]

Stashes the upload and shows the main upload form.

Note: only errors that can be handled by changing the name or description should be redirected here. It should be assumed that the file itself is sane and has passed UploadBase::verifyFile. This essentially means that UploadBase::VERIFICATION_ERROR and UploadBase::EMPTY_FILE should not be passed here.

Parameters:
string$messageHTML message to be passed to mainUploadForm

Definition at line 309 of file SpecialUpload.php.

SpecialUpload::showUploadError ( message) [protected]

Show the upload form with error message, but do not stash the file.

Parameters:
string$messageHTML string

Definition at line 383 of file SpecialUpload.php.

SpecialUpload::showUploadForm ( form) [protected]

Show the main upload form.

Parameters:
$formMixed: an HTMLForm instance or HTML string to show

Definition at line 198 of file SpecialUpload.php.

SpecialUpload::showUploadWarning ( warnings) [protected]

Stashes the upload, shows the main form, but adds a "continue anyway button".

Also checks whether there are actually warnings to display.

Parameters:
$warningsArray
Returns:
boolean true if warnings were displayed, false if there are no warnings and it should continue processing

Definition at line 326 of file SpecialUpload.php.

Shows the "view X deleted revivions link"".

Definition at line 280 of file SpecialUpload.php.

Remove a temporarily kept file stashed by saveTempUploadedFile().

Returns:
Boolean: success

Definition at line 613 of file SpecialUpload.php.

This page can be shown if uploading is enabled.

Handle permission checking elsewhere in order to be able to show custom error messages.

Parameters:
$userUser object
Returns:
Boolean

Reimplemented from SpecialPage.

Definition at line 131 of file SpecialUpload.php.


Member Data Documentation

SpecialUpload::$mCancelUpload

Definition at line 68 of file SpecialUpload.php.

SpecialUpload::$mComment

Definition at line 56 of file SpecialUpload.php.

SpecialUpload::$mCopyrightSource

Definition at line 63 of file SpecialUpload.php.

SpecialUpload::$mCopyrightStatus

Definition at line 62 of file SpecialUpload.php.

SpecialUpload::$mDesiredDestName

User input variables from the "description" section.

Definition at line 55 of file SpecialUpload.php.

SpecialUpload::$mDestWarningAck

Hidden variables.

Definition at line 66 of file SpecialUpload.php.

SpecialUpload::$mForReUpload

Definition at line 67 of file SpecialUpload.php.

SpecialUpload::$mIgnoreWarning

User input variables from the root section.

Definition at line 60 of file SpecialUpload.php.

SpecialUpload::$mLicense

Definition at line 57 of file SpecialUpload.php.

LocalFile SpecialUpload::$mLocalFile

Definition at line 51 of file SpecialUpload.php.

SpecialUpload::$mRequest

Misc variables.

Definition at line 42 of file SpecialUpload.php.

SpecialUpload::$mSourceType

Definition at line 43 of file SpecialUpload.php.

SpecialUpload::$mTokenOk

Definition at line 69 of file SpecialUpload.php.

UploadBase SpecialUpload::$mUpload

Definition at line 47 of file SpecialUpload.php.

SpecialUpload::$mUploadClicked

Definition at line 52 of file SpecialUpload.php.

SpecialUpload::$mUploadSuccessful = false

Definition at line 70 of file SpecialUpload.php.

SpecialUpload::$mWatchThis

Definition at line 61 of file SpecialUpload.php.

SpecialUpload::$mWatchthis

Definition at line 76 of file SpecialUpload.php.

SpecialUpload::$uploadFormTextAfterSummary

Definition at line 74 of file SpecialUpload.php.

SpecialUpload::$uploadFormTextTop

Text injection points for hooks not using HTMLForm.

Definition at line 73 of file SpecialUpload.php.


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