MediaWiki
REL1_23
|
Implements uploading from chunks. More...
Public Member Functions | |
__construct ($user=null, $stash=false, $repo=false) | |
Setup local pointers to stash, repo and user (similar to UploadFromStash) | |
addChunk ($chunkPath, $chunkSize, $offset) | |
Add a chunk to the temporary directory. | |
concatenateChunks () | |
Append the final chunk and ready file for parent::performUpload() | |
continueChunks ($name, $key, $webRequestUpload) | |
Continue chunk uploading. | |
getVirtualChunkLocation ($index) | |
Returns the virtual chunk location: | |
performUpload ($comment, $pageText, $watch, $user) | |
Perform the upload, then remove the temp copy afterward. | |
stashFile (User $user=null) | |
Calls the parent stashFile and updates the uploadsession table to handle "chunks". | |
Protected Attributes | |
$mChunkIndex | |
$mFileKey | |
$mOffset | |
$mVirtualTempPath | |
Private Member Functions | |
getChunkFileKey ($index=null) | |
getChunkIndex () | |
Get the current Chunk index. | |
getChunkStatus () | |
Get the chunk db state and populate update relevant local values. | |
getOffset () | |
Gets the current offset in fromt the stashedupload table. | |
outputChunk ($chunkPath) | |
Output the chunk to disk. | |
updateChunkStatus () | |
Update the chunk db table with the current status: | |
verifyChunk () | |
Verify that the chunk isn't really an evil html file. |
Implements uploading from chunks.
Definition at line 30 of file UploadFromChunks.php.
UploadFromChunks::__construct | ( | $ | user = null , |
$ | stash = false , |
||
$ | repo = false |
||
) |
Setup local pointers to stash, repo and user (similar to UploadFromStash)
$user | User|null Default: null |
$stash | UploadStash|bool Default: false |
$repo | FileRepo|bool Default: false |
Definition at line 43 of file UploadFromChunks.php.
References $user, RepoGroup\singleton(), user, and wfDebug().
UploadFromChunks::addChunk | ( | $ | chunkPath, |
$ | chunkSize, | ||
$ | offset | ||
) |
Add a chunk to the temporary directory.
string | $chunkPath | path to temporary chunk file |
int | $chunkSize | size of the current chunk |
int | $offset | offset of current chunk ( mutch match database chunk offset ) |
Definition at line 201 of file UploadFromChunks.php.
References $e, UploadBase\getMaxUploadSize(), getOffset(), Status\newFatal(), outputChunk(), updateChunkStatus(), and verifyChunk().
Append the final chunk and ready file for parent::performUpload()
Definition at line 113 of file UploadFromChunks.php.
References $ext, $ret, array(), FileRepo\DELETE_SOURCE, FileBackend\extensionFromPath(), TempFSFile\factory(), getChunkIndex(), getOffset(), UploadBase\getVerificationErrorCode(), getVirtualChunkLocation(), UploadBase\OK, stashFile(), user, UploadFromFile\verifyUpload(), wfDebug(), and wfDebugLog().
UploadFromChunks::continueChunks | ( | $ | name, |
$ | key, | ||
$ | webRequestUpload | ||
) |
Continue chunk uploading.
Definition at line 95 of file UploadFromChunks.php.
References $key, $name, getChunkStatus(), UploadBase\getRealPath(), and UploadBase\initializePathInfo().
UploadFromChunks::getChunkFileKey | ( | $ | index = null | ) | [private] |
Definition at line 339 of file UploadFromChunks.php.
References getChunkIndex().
Referenced by getVirtualChunkLocation(), and outputChunk().
UploadFromChunks::getChunkIndex | ( | ) | [private] |
Get the current Chunk index.
Definition at line 288 of file UploadFromChunks.php.
Referenced by concatenateChunks(), getChunkFileKey(), and updateChunkStatus().
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().
UploadFromChunks::getOffset | ( | ) | [private] |
Gets the current offset in fromt the stashedupload table.
Definition at line 299 of file UploadFromChunks.php.
Referenced by addChunk(), concatenateChunks(), and updateChunkStatus().
UploadFromChunks::getVirtualChunkLocation | ( | $ | index | ) |
Returns the virtual chunk location:
$index |
Definition at line 184 of file UploadFromChunks.php.
References getChunkFileKey().
Referenced by concatenateChunks().
UploadFromChunks::outputChunk | ( | $ | chunkPath | ) | [private] |
Output the chunk to disk.
$chunkPath | string |
UploadChunkFileException |
Definition at line 313 of file UploadFromChunks.php.
References $error, array(), and getChunkFileKey().
Referenced by addChunk(), and stashFile().
UploadFromChunks::performUpload | ( | $ | comment, |
$ | pageText, | ||
$ | watch, | ||
$ | user | ||
) |
Perform the upload, then remove the temp copy afterward.
$comment | string |
$pageText | string |
$watch | bool |
$user | User |
Reimplemented from UploadBase.
Definition at line 174 of file UploadFromChunks.php.
UploadFromChunks::stashFile | ( | User $ | user = null | ) |
Calls the parent stashFile and updates the uploadsession table to handle "chunks".
Reimplemented from UploadBase.
Definition at line 72 of file UploadFromChunks.php.
References outputChunk(), updateChunkStatus(), and verifyChunk().
Referenced by concatenateChunks().
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().
UploadFromChunks::verifyChunk | ( | ) | [private] |
Verify that the chunk isn't really an evil html file.
UploadChunkVerificationException |
Definition at line 351 of file UploadFromChunks.php.
References $res, and UploadBase\verifyPartialFile().
Referenced by addChunk(), and stashFile().
UploadFromChunks::$mChunkIndex [protected] |
Definition at line 32 of file UploadFromChunks.php.
UploadFromChunks::$mFileKey [protected] |
Definition at line 33 of file UploadFromChunks.php.
UploadFromChunks::$mOffset [protected] |
Definition at line 31 of file UploadFromChunks.php.
UploadFromChunks::$mVirtualTempPath [protected] |
Definition at line 34 of file UploadFromChunks.php.