ILIAS
trunk Revision v11.0_alpha-1761-g6dbbfa7b760
|
Class FileUploadImpl. More...
Public Member Functions | ||||||||||||||||
__construct (private PreProcessorManager $processorManager, private Filesystems $filesystems, private GlobalHttpState $globalHttpState) | ||||||||||||||||
FileUploadImpl constructor. More... | ||||||||||||||||
moveOneFileTo (UploadResult $uploadResult, string $destination, int $location=Location::STORAGE, string $file_name='', bool $override_existing=false) | ||||||||||||||||
Moves a single File (the attributes, metadata and upload-status of which are contained in UploadResult) to the given destination.The destination is a relative path which refers to the path of the location.
| ||||||||||||||||
moveFilesTo (string $destination, int $location=Location::STORAGE) | ||||||||||||||||
uploadSizeLimit () | ||||||||||||||||
register (PreProcessor $preProcessor) | ||||||||||||||||
process () | ||||||||||||||||
getResults () | ||||||||||||||||
hasUploads () | ||||||||||||||||
hasBeenProcessed () | ||||||||||||||||
Return (bool)true if the current upload has already been processed. More... | ||||||||||||||||
Protected Member Functions | |
flattenUploadedFiles (array $uploadedFiles) | |
Private Member Functions | |
hardRemoveUpload (string $identifier, ProcessingStatus $status) | |
This is the very last thing we can do if a preprocessor DENIEs an upload. More... | |
regenerateUploadResultWithPath (UploadResult $result, string $path) | |
Generate an exact copy of the result with the given path. More... | |
regenerateUploadResultWithCopyError (UploadResult $result, string $errorReason) | |
Creates a clone of the given result and set the status to rejected with the passed error message. More... | |
selectFilesystem (int $location) | |
Selects the correct filesystem by the given Location constant. More... | |
rejectFailedUpload (Metadata $metadata) | |
Reject a failed upload with the given metadata. More... | |
Private Attributes | |
bool | $processed = false |
bool | $moved = false |
array | $uploadResult = [] |
array | $rejectedUploadResult = [] |
array | $uploadStreams = null |
ILIAS\FileUpload\FileUploadImpl::__construct | ( | private PreProcessorManager | $processorManager, |
private Filesystems | $filesystems, | ||
private GlobalHttpState | $globalHttpState | ||
) |
FileUploadImpl constructor.
PreProcessorManager | $processorManager | The processor manager which should be used. |
Filesystems | $filesystems | The Filesystems implementation which should be used. |
GlobalHttpState | $globalHttpState | The http implementation which should be used to detect the uploaded files. |
Definition at line 73 of file FileUploadImpl.php.
|
protected |
Definition at line 349 of file FileUploadImpl.php.
Referenced by ILIAS\FileUpload\FileUploadImpl\hasUploads(), and ILIAS\FileUpload\FileUploadImpl\process().
ILIAS\FileUpload\FileUploadImpl::getResults | ( | ) |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 324 of file FileUploadImpl.php.
|
private |
This is the very last thing we can do if a preprocessor DENIEs an upload.
This is a hard removal, not beautiful, but it works.
Definition at line 81 of file FileUploadImpl.php.
Referenced by ILIAS\FileUpload\FileUploadImpl\process().
ILIAS\FileUpload\FileUploadImpl::hasBeenProcessed | ( | ) |
Return (bool)true if the current upload has already been processed.
Implements ILIAS\FileUpload\FileUpload.
Definition at line 363 of file FileUploadImpl.php.
References ILIAS\FileUpload\FileUploadImpl\$processed.
ILIAS\FileUpload\FileUploadImpl::hasUploads | ( | ) |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 337 of file FileUploadImpl.php.
References ILIAS\FileUpload\FileUploadImpl\flattenUploadedFiles().
ILIAS\FileUpload\FileUploadImpl::moveFilesTo | ( | string | $destination, |
int | $location = Location::STORAGE |
||
) |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 126 of file FileUploadImpl.php.
References $location, $path, null, ILIAS\Filesystem\Stream\Streams\ofPsr7Stream(), ILIAS\FileUpload\FileUploadImpl\regenerateUploadResultWithCopyError(), ILIAS\FileUpload\FileUploadImpl\regenerateUploadResultWithPath(), ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED, and ILIAS\FileUpload\FileUploadImpl\selectFilesystem().
ILIAS\FileUpload\FileUploadImpl::moveOneFileTo | ( | UploadResult | $uploadResult, |
string | $destination, | ||
int | $location = Location::STORAGE , |
||
string | $file_name = '' , |
||
bool | $override_existing = false |
||
) |
Moves a single File (the attributes, metadata and upload-status of which are contained in UploadResult) to the given destination.The destination is a relative path which refers to the path of the location.
UploadResult | $uploadResult | Which upload result do you want to move? |
string | $destination | Where do you want to move the file? |
int | $location | Location::[STORAGE|WEB|CUSTOMIZING] |
string | $file_name | Do you want to rename the file? |
bool | $override_existing | Override existing file with same name |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 96 of file FileUploadImpl.php.
References $location, $path, ILIAS\Filesystem\Stream\Streams\ofPsr7Stream(), ILIAS\FileUpload\FileUploadImpl\regenerateUploadResultWithCopyError(), ILIAS\FileUpload\FileUploadImpl\regenerateUploadResultWithPath(), ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED, and ILIAS\FileUpload\FileUploadImpl\selectFilesystem().
ILIAS\FileUpload\FileUploadImpl::process | ( | ) |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 247 of file FileUploadImpl.php.
References ILIAS\FileUpload\DTO\ProcessingStatus\DENIED, ILIAS\FileUpload\FileUploadImpl\flattenUploadedFiles(), ILIAS\FileUpload\FileUploadImpl\hardRemoveUpload(), ILIAS\Filesystem\Stream\Streams\ofPsr7Stream(), and ILIAS\FileUpload\FileUploadImpl\rejectFailedUpload().
|
private |
Creates a clone of the given result and set the status to rejected with the passed error message.
UploadResult | $result | The result which should be cloned. |
string | $errorReason | The reason why the error occurred. |
Definition at line 188 of file FileUploadImpl.php.
References ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED.
Referenced by ILIAS\FileUpload\FileUploadImpl\moveFilesTo(), and ILIAS\FileUpload\FileUploadImpl\moveOneFileTo().
|
private |
Generate an exact copy of the result with the given path.
UploadResult | $result | The result which should be cloned. |
string | $path | The path which should be set on the result clone. |
Definition at line 167 of file FileUploadImpl.php.
References $path.
Referenced by ILIAS\FileUpload\FileUploadImpl\moveFilesTo(), and ILIAS\FileUpload\FileUploadImpl\moveOneFileTo().
ILIAS\FileUpload\FileUploadImpl::register | ( | PreProcessor | $preProcessor | ) |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 234 of file FileUploadImpl.php.
|
private |
Reject a failed upload with the given metadata.
Metadata | $metadata | The metadata used to create the rejected result. |
Definition at line 303 of file FileUploadImpl.php.
References ILIAS\FileUpload\DTO\ProcessingStatus\REJECTED.
Referenced by ILIAS\FileUpload\FileUploadImpl\process().
|
private |
Selects the correct filesystem by the given Location constant.
int | $location | The storage location constant defined within the Location interface. |
Definition at line 210 of file FileUploadImpl.php.
References ILIAS\FileUpload\Location\CUSTOMIZING, ILIAS\Filesystem\filesystems(), ILIAS\FileUpload\Location\STORAGE, ILIAS\FileUpload\Location\TEMPORARY, and ILIAS\FileUpload\Location\WEB.
Referenced by ILIAS\FileUpload\FileUploadImpl\moveFilesTo(), and ILIAS\FileUpload\FileUploadImpl\moveOneFileTo().
ILIAS\FileUpload\FileUploadImpl::uploadSizeLimit | ( | ) |
Implements ILIAS\FileUpload\FileUpload.
Definition at line 225 of file FileUploadImpl.php.
References ilFileUtils\getPhpUploadSizeLimitInBytes().
|
private |
Definition at line 49 of file FileUploadImpl.php.
|
private |
Definition at line 48 of file FileUploadImpl.php.
Referenced by ILIAS\FileUpload\FileUploadImpl\hasBeenProcessed().
|
private |
Definition at line 57 of file FileUploadImpl.php.
|
private |
Definition at line 53 of file FileUploadImpl.php.
|
private |
Definition at line 61 of file FileUploadImpl.php.