MediaWiki
1.34.0
|
Implements uploading from chunks. More...
Public Member Functions | |
__construct (User $user, $stash=false, $repo=false) | |
@noinspection PhpMissingParentConstructorInspection 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... | |
getOffset () | |
Get the offset at which the next uploaded chunk will be appended to. More... | |
getVirtualChunkLocation ( $index) | |
Returns the virtual chunk location: More... | |
stashFile (User $user=null) | |
tryStashFile (User $user, $isPartial=false) | |
Public Member Functions inherited from UploadFromFile | |
getSourceType () | |
initialize ( $name, $webRequestUpload) | |
Initialize from a filename and a WebRequestUpload. More... | |
initializeFromRequest (&$request) | |
verifyUpload () | |
Public Attributes | |
UploadStash | $stash |
User | $user |
Protected Member Functions | |
doStashFile (User $user=null) | |
Calls the parent doStashFile and updates the uploadsession table to handle "chunks". More... | |
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... | |
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... | |
Private Attributes | |
LocalRepo | $repo |
Additional Inherited Members | |
Static Public Member Functions inherited from UploadFromFile | |
static | isValidRequest ( $request) |
Implements uploading from chunks.
Definition at line 33 of file UploadFromChunks.php.
UploadFromChunks::__construct | ( | User | $user, |
$stash = false , |
|||
$repo = false |
|||
) |
@noinspection PhpMissingParentConstructorInspection
Setup local pointers to stash, repo and user (similar to UploadFromStash)
User | $user | |
UploadStash | bool | $stash | Default: false |
FileRepo | bool | $repo | Default: false |
Definition at line 55 of file UploadFromChunks.php.
References $repo, $stash, $user, User\getId(), RepoGroup\singleton(), 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 238 of file UploadFromChunks.php.
References $status, getOffset(), MWException\msg(), StatusValue\newFatal(), outputChunk(), updateChunkStatus(), and verifyChunk().
UploadFromChunks::concatenateChunks | ( | ) |
Append the final chunk and ready file for parent::performUpload()
Definition at line 148 of file UploadFromChunks.php.
References $ext, $status, FileRepo\DELETE_SOURCE, FileBackend\extensionFromPath(), getChunkIndex(), getOffset(), getVirtualChunkLocation(), UploadFromFile\verifyUpload(), wfDebug(), and wfDebugLog().
UploadFromChunks::continueChunks | ( | $name, | |
$key, | |||
$webRequestUpload | |||
) |
Continue chunk uploading.
string | $name | |
string | $key | |
WebRequestUpload | $webRequestUpload |
Definition at line 130 of file UploadFromChunks.php.
References getChunkStatus().
|
protected |
Calls the parent doStashFile and updates the uploadsession table to handle "chunks".
User | null | $user |
Definition at line 103 of file UploadFromChunks.php.
References $user, outputChunk(), and updateChunkStatus().
|
private |
Definition at line 376 of file UploadFromChunks.php.
References getChunkIndex().
Referenced by getVirtualChunkLocation(), and outputChunk().
|
private |
Get the current Chunk index.
Definition at line 322 of file UploadFromChunks.php.
References $mChunkIndex.
Referenced by concatenateChunks(), getChunkFileKey(), and updateChunkStatus().
|
private |
Get the chunk db state and populate update relevant local values.
Definition at line 296 of file UploadFromChunks.php.
Referenced by continueChunks().
UploadFromChunks::getOffset | ( | ) |
Get the offset at which the next uploaded chunk will be appended to.
Definition at line 334 of file UploadFromChunks.php.
References $mOffset.
Referenced by addChunk(), concatenateChunks(), and updateChunkStatus().
UploadFromChunks::getVirtualChunkLocation | ( | $index | ) |
Returns the virtual chunk location:
int | $index |
Definition at line 221 of file UploadFromChunks.php.
References getChunkFileKey().
Referenced by concatenateChunks().
|
private |
Output the chunk to disk.
string | $chunkPath |
UploadChunkFileException |
Definition at line 349 of file UploadFromChunks.php.
References getChunkFileKey().
Referenced by addChunk(), and doStashFile().
UploadFromChunks::stashFile | ( | User | $user = null | ) |
UploadChunkVerificationException |
Definition at line 90 of file UploadFromChunks.php.
References $user, verifyChunk(), and wfDeprecated().
UploadFromChunks::tryStashFile | ( | User | $user, |
$isPartial = false |
|||
) |
Definition at line 75 of file UploadFromChunks.php.
References $user, MWException\msg(), StatusValue\newFatal(), and verifyChunk().
|
private |
Update the chunk db table with the current status:
Definition at line 276 of file UploadFromChunks.php.
References getChunkIndex(), getOffset(), and wfDebug().
Referenced by addChunk(), and doStashFile().
|
private |
Verify that the chunk isn't really an evil html file.
UploadChunkVerificationException |
Definition at line 389 of file UploadFromChunks.php.
References $mFileKey, and $res.
Referenced by addChunk(), stashFile(), and tryStashFile().
|
protected |
Definition at line 42 of file UploadFromChunks.php.
Referenced by getChunkIndex().
|
protected |
Definition at line 43 of file UploadFromChunks.php.
Referenced by verifyChunk().
|
protected |
Definition at line 41 of file UploadFromChunks.php.
Referenced by getOffset().
|
protected |
Definition at line 44 of file UploadFromChunks.php.
|
private |
Definition at line 35 of file UploadFromChunks.php.
Referenced by __construct().
UploadStash UploadFromChunks::$stash |
Definition at line 37 of file UploadFromChunks.php.
Referenced by __construct().
User UploadFromChunks::$user |
Definition at line 39 of file UploadFromChunks.php.
Referenced by __construct(), doStashFile(), stashFile(), and tryStashFile().