MediaWiki  1.23.12
UploadFromChunks Class Reference

Implements uploading from chunks. More...

Inheritance diagram for UploadFromChunks:
Collaboration diagram for UploadFromChunks:

Public Member Functions

 __construct ( $user=null, $stash=false, $repo=false)
 Setup local pointers to stash, repo and user (similar to UploadFromStash) More...
 
 addChunk ( $chunkPath, $chunkSize, $offset)
 Add a chunk to the temporary directory. More...
 
 concatenateChunks ()
 Append the final chunk and ready file for parent::performUpload() More...
 
 continueChunks ( $name, $key, $webRequestUpload)
 Continue chunk uploading. More...
 
 getVirtualChunkLocation ( $index)
 Returns the virtual chunk location: More...
 
 performUpload ( $comment, $pageText, $watch, $user)
 Perform the upload, then remove the temp copy afterward. More...
 
 stashFile (User $user=null)
 Calls the parent stashFile and updates the uploadsession table to handle "chunks". More...
 
- Public Member Functions inherited from UploadFromFile
 getSourceType ()
 
 initialize ( $name, $webRequestUpload)
 Initialize from a filename and a WebRequestUpload. More...
 
 initializeFromRequest (&$request)
 
 verifyUpload ()
 

Protected Attributes

 $mChunkIndex
 
 $mFileKey
 
 $mOffset
 
 $mVirtualTempPath
 
- Protected Attributes inherited from UploadFromFile
WebRequestUpload $mUpload = null
 

Private Member Functions

 getChunkFileKey ( $index=null)
 
 getChunkIndex ()
 Get the current Chunk index. More...
 
 getChunkStatus ()
 Get the chunk db state and populate update relevant local values. More...
 
 getOffset ()
 Gets the current offset in fromt the stashedupload table. More...
 
 outputChunk ( $chunkPath)
 Output the chunk to disk. More...
 
 updateChunkStatus ()
 Update the chunk db table with the current status: More...
 
 verifyChunk ()
 Verify that the chunk isn't really an evil html file. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from UploadFromFile
static isValidRequest ( $request)
 

Detailed Description

Implements uploading from chunks.

Author
Michael Dale

Definition at line 30 of file UploadFromChunks.php.

Constructor & Destructor Documentation

◆ __construct()

UploadFromChunks::__construct (   $user = null,
  $stash = false,
  $repo = false 
)

Setup local pointers to stash, repo and user (similar to UploadFromStash)

Parameters
$userUser|null Default: null
$stashUploadStash|bool Default: false
$repoFileRepo|bool Default: false

Definition at line 43 of file UploadFromChunks.php.

References $user, RepoGroup\singleton(), user, and wfDebug().

Member Function Documentation

◆ addChunk()

UploadFromChunks::addChunk (   $chunkPath,
  $chunkSize,
  $offset 
)

Add a chunk to the temporary directory.

Parameters
string$chunkPathpath to temporary chunk file
int$chunkSizesize of the current chunk
int$offsetoffset of current chunk ( mutch match database chunk offset )
Returns
Status

Definition at line 201 of file UploadFromChunks.php.

References $e, getOffset(), Status\newFatal(), outputChunk(), updateChunkStatus(), and verifyChunk().

◆ concatenateChunks()

UploadFromChunks::concatenateChunks ( )

◆ continueChunks()

UploadFromChunks::continueChunks (   $name,
  $key,
  $webRequestUpload 
)

Continue chunk uploading.

Definition at line 95 of file UploadFromChunks.php.

References $name, and getChunkStatus().

◆ getChunkFileKey()

UploadFromChunks::getChunkFileKey (   $index = null)
private

Definition at line 339 of file UploadFromChunks.php.

References getChunkIndex().

Referenced by getVirtualChunkLocation(), and outputChunk().

◆ getChunkIndex()

UploadFromChunks::getChunkIndex ( )
private

Get the current Chunk index.

Returns
Integer index of the current chunk

Definition at line 288 of file UploadFromChunks.php.

References $mChunkIndex.

Referenced by concatenateChunks(), getChunkFileKey(), and updateChunkStatus().

◆ getChunkStatus()

UploadFromChunks::getChunkStatus ( )
private

Get the chunk db state and populate update relevant local values.

Definition at line 262 of file UploadFromChunks.php.

References array().

Referenced by continueChunks().

◆ getOffset()

UploadFromChunks::getOffset ( )
private

Gets the current offset in fromt the stashedupload table.

Returns
Integer current byte offset of the chunk file set

Definition at line 299 of file UploadFromChunks.php.

References $mOffset.

Referenced by addChunk(), concatenateChunks(), and updateChunkStatus().

◆ getVirtualChunkLocation()

UploadFromChunks::getVirtualChunkLocation (   $index)

Returns the virtual chunk location:

Parameters
$index
Returns
string

Definition at line 184 of file UploadFromChunks.php.

References getChunkFileKey().

Referenced by concatenateChunks().

◆ outputChunk()

UploadFromChunks::outputChunk (   $chunkPath)
private

Output the chunk to disk.

Parameters
$chunkPathstring
Exceptions
UploadChunkFileException
Returns
FileRepoStatus

Definition at line 313 of file UploadFromChunks.php.

References $error, array(), and getChunkFileKey().

Referenced by addChunk(), and stashFile().

◆ performUpload()

UploadFromChunks::performUpload (   $comment,
  $pageText,
  $watch,
  $user 
)

Perform the upload, then remove the temp copy afterward.

Parameters
$commentstring
$pageTextstring
$watchbool
$userUser
Returns
Status

Definition at line 174 of file UploadFromChunks.php.

References $comment, and $user.

◆ stashFile()

UploadFromChunks::stashFile ( User  $user = null)

Calls the parent stashFile and updates the uploadsession table to handle "chunks".

Returns
UploadStashFile stashed file

Definition at line 72 of file UploadFromChunks.php.

References outputChunk(), updateChunkStatus(), and verifyChunk().

◆ updateChunkStatus()

UploadFromChunks::updateChunkStatus ( )
private

Update the chunk db table with the current status:

Definition at line 238 of file UploadFromChunks.php.

References array(), getChunkIndex(), getOffset(), and wfDebug().

Referenced by addChunk(), and stashFile().

◆ verifyChunk()

UploadFromChunks::verifyChunk ( )
private

Verify that the chunk isn't really an evil html file.

Exceptions
UploadChunkVerificationException

Definition at line 351 of file UploadFromChunks.php.

References $mFileKey, and $res.

Referenced by addChunk(), and stashFile().

Member Data Documentation

◆ $mChunkIndex

UploadFromChunks::$mChunkIndex
protected

Definition at line 32 of file UploadFromChunks.php.

Referenced by getChunkIndex().

◆ $mFileKey

UploadFromChunks::$mFileKey
protected

Definition at line 33 of file UploadFromChunks.php.

Referenced by verifyChunk().

◆ $mOffset

UploadFromChunks::$mOffset
protected

Definition at line 31 of file UploadFromChunks.php.

Referenced by getOffset().

◆ $mVirtualTempPath

UploadFromChunks::$mVirtualTempPath
protected

Definition at line 34 of file UploadFromChunks.php.


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