MediaWiki  1.23.0
UploadFromUrlJob Class Reference

Job for asynchronous upload-by-url. More...

Inheritance diagram for UploadFromUrlJob:
Collaboration diagram for UploadFromUrlJob:

Public Member Functions

 __construct ( $title, $params)
 
 initializeSessionData ()
 Initialize the session data. More...
 
 run ()
 Run the job. More...
 
- Public Member Functions inherited from Job
 __construct ( $command, $title, $params=false)
 
 allowRetries ()
 
 getDeduplicationInfo ()
 Subclasses may need to override this to make duplication detection work. More...
 
 getLastError ()
 
 getParams ()
 
 getReleaseTimestamp ()
 
 getRootJobParams ()
 
 getTitle ()
 
 getType ()
 
 hasRootJobParams ()
 
 ignoreDuplicates ()
 
 insert ()
 Insert a single job into the queue. More...
 
 toString ()
 
 workItemCount ()
 

Static Public Member Functions

static & getSessionData ( $key)
 
- Static Public Member Functions inherited from Job
static batchInsert ( $jobs)
 Batch-insert a group of jobs into the queue. More...
 
static factory ( $command, Title $title, $params=false)
 Create the appropriate object to handle a specific job. More...
 
static newRootJobParams ( $key)
 
static pop ()
 Pop a job off the front of the queue. More...
 
static pop_type ( $type)
 Pop a job of a certain type. More...
 
static safeBatchInsert ( $jobs)
 Insert a group of jobs into the queue. More...
 

Public Attributes

UploadFromUrl $upload
 
const SESSION_KEYNAME = 'wsUploadFromUrlJobData'
 
- Public Attributes inherited from Job
string $command
 
array $metadata = array()
 Additional queue metadata *. More...
 
array bool $params
 Array of job parameters or false if none *. More...
 

Protected Member Functions

 leaveMessage ( $status)
 Leave a message on the user talk page or in the session according to $params['leaveMessage']. More...
 
 storeResultInSession ( $result, $dataKey, $dataValue)
 Store a result in the session data. More...
 
- Protected Member Functions inherited from Job
 setLastError ( $error)
 

Protected Attributes

User $user
 
- Protected Attributes inherited from Job
string $error
 Text for error that occurred last *. More...
 
bool $removeDuplicates
 Expensive jobs may set this to true *. More...
 
Title $title
 

Detailed Description

Job for asynchronous upload-by-url.

This job is in fact an interface to UploadFromUrl, which is designed such that it does not require any globals. If it does, fix it elsewhere, do not add globals in here.

Definition at line 33 of file UploadFromUrlJob.php.

Constructor & Destructor Documentation

◆ __construct()

UploadFromUrlJob::__construct (   $title,
  $params 
)

Definition at line 40 of file UploadFromUrlJob.php.

References Job\$params, and Job\$title.

Member Function Documentation

◆ getSessionData()

static& UploadFromUrlJob::getSessionData (   $key)
static
Parameters
$key
Returns
mixed

Definition at line 178 of file UploadFromUrlJob.php.

References array(), and SESSION_KEYNAME.

Referenced by initializeSessionData(), ApiUpload\selectUploadModule(), and storeResultInSession().

◆ initializeSessionData()

UploadFromUrlJob::initializeSessionData ( )

Initialize the session data.

Sets the intial result to queued.

Definition at line 169 of file UploadFromUrlJob.php.

References getSessionData().

◆ leaveMessage()

UploadFromUrlJob::leaveMessage (   $status)
protected

Leave a message on the user talk page or in the session according to $params['leaveMessage'].

Parameters
Status$status

Definition at line 122 of file UploadFromUrlJob.php.

References storeResultInSession(), text, user, wfMessage(), and wfSetupSession().

Referenced by run().

◆ run()

UploadFromUrlJob::run ( )

Run the job.

Returns
bool Success

Reimplemented from Job.

Definition at line 44 of file UploadFromUrlJob.php.

References array(), false, global, leaveMessage(), User\newFromName(), UploadBase\OK, storeResultInSession(), text, title, user, wfMessage(), and wfSetupSession().

◆ storeResultInSession()

UploadFromUrlJob::storeResultInSession (   $result,
  $dataKey,
  $dataValue 
)
protected

Store a result in the session data.

Note that the caller is responsible for appropriate session_start and session_write_close calls.

Parameters
string$resultthe result (Success|Warning|Failure)
string$dataKeythe key of the extra data
mixed$dataValueThe extra data itself

Definition at line 160 of file UploadFromUrlJob.php.

References getSessionData().

Referenced by leaveMessage(), and run().

Member Data Documentation

◆ $upload

UploadFromUrl UploadFromUrlJob::$upload

Definition at line 36 of file UploadFromUrlJob.php.

◆ $user

User UploadFromUrlJob::$user
protected

Definition at line 38 of file UploadFromUrlJob.php.

◆ SESSION_KEYNAME

const UploadFromUrlJob::SESSION_KEYNAME = 'wsUploadFromUrlJobData'

Definition at line 34 of file UploadFromUrlJob.php.

Referenced by getSessionData().


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