ILIAS
trunk Revision v11.0_alpha-2645-g16283d3b3f8
|
Fly system file access implementation. More...
Public Member Functions | |
__construct (private FilesystemOperator $flysystem_operator) | |
read (string $path) | |
Reads a file content to a string. More... | |
has (string $path) | |
Checks whether a file exists. More... | |
getMimeType (string $path) | |
Get a files mime-type. More... | |
getTimestamp (string $path) | |
Get the timestamp of the file. More... | |
getSize (string $path, int $unit) | |
Get the size of a file. More... | |
setVisibility (string $path, string $visibility) | |
Sets the visibility for a file. More... | |
getVisibility (string $path) | |
Get the file visibility. More... | |
write (string $path, string $content) | |
Writes the content to a new file. More... | |
update (string $path, string $new_content) | |
Updates the content of a file. More... | |
put (string $path, string $content) | |
Creates a file or updates an existing one. More... | |
delete (string $path) | |
Deletes a file. More... | |
readAndDelete (string $path) | |
Reads the entire file content into a string and removes the file afterwards. More... | |
rename (string $path, string $new_path) | |
Moves a file from the source to the destination. More... | |
copy (string $path, string $copy_path) | |
Copy the source file to a destination. More... | |
Private Member Functions | |
validateVisibility (string $visibility) | |
Checks if the given visibility is valid an throws an exception otherwise. More... | |
Fly system file access implementation.
Definition at line 43 of file FlySystemFileAccess.php.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::__construct | ( | private FilesystemOperator | $flysystem_operator | ) |
Definition at line 45 of file FlySystemFileAccess.php.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::copy | ( | string | $path, |
string | $copy_path | ||
) |
Copy the source file to a destination.
string | $path | The source path to the file which should be copied. |
string | $copy_path | The destination path of the file copy. |
FileNotFoundException | If the source file does not exist. |
FileAlreadyExistsException | If the destination file already exists. |
IOException | If the file could not be copied to the destination. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 333 of file FlySystemFileAccess.php.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::delete | ( | string | $path | ) |
Deletes a file.
string | $path | The path to the file which should be deleted. |
FileNotFoundException | If the file was not found. |
IOException | If the file was found but the delete operation finished with errors. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 264 of file FlySystemFileAccess.php.
References $path.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::getMimeType | ( | string | $path | ) |
Get a files mime-type.
string | $path | The file which should be used to get the mime-type. |
FileNotFoundException | If the file is not found. |
IOException | If the mime-type could not be determined. |
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 74 of file FlySystemFileAccess.php.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::getSize | ( | string | $path, |
int | $unit | ||
) |
Get the size of a file.
The file size units are provided by the DataSize class.
string | $path | The path to the file. |
int | $unit | The unit of the file size, which are defined in the DataSize class. |
IOException | Thrown if the file is not accessible or the underlying filesystem adapter failed. |
FileNotFoundException | Thrown if the specified file was not found. |
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 101 of file FlySystemFileAccess.php.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::getTimestamp | ( | string | $path | ) |
Get the timestamp of the file.
string | $path | The path to the file. |
FileNotFoundException | If the file is not found. |
IOException | If the file can not be red. |
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 88 of file FlySystemFileAccess.php.
References ILIAS\Repository\int().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::getVisibility | ( | string | $path | ) |
Get the file visibility.
The file visibility could be 'public' or 'private'.
Please note that the Visibility interface defines two constants PUBLIC_ACCESS and PRIVATE_ACCESS to ease the development process.
string | $path | The path to the file which should be used. |
FileNotFoundException | If the file could not be found. |
IOException | If the underlying adapter failed to determine the visibility. |
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 168 of file FlySystemFileAccess.php.
References ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\has().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::has | ( | string | $path | ) |
Checks whether a file exists.
string | $path | The file path which should be checked. |
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 69 of file FlySystemFileAccess.php.
Referenced by ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\getVisibility(), and ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\setVisibility().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::put | ( | string | $path, |
string | $content | ||
) |
Creates a file or updates an existing one.
string | $path | The path to the file which should be created or updated. |
string | $content | The content which should be written to the file. |
IOException | If the file could not be created or updated. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 245 of file FlySystemFileAccess.php.
References ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\update(), and ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\write().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::read | ( | string | $path | ) |
Reads a file content to a string.
string | $path | The path to the file which should be read. |
FileNotFoundException | If the file doesn't exist. |
IOException | If the file could not be red. |
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 50 of file FlySystemFileAccess.php.
References ILIAS\Filesystem\Provider\FlySystem\Util\normalizeRelativePath().
Referenced by ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\readAndDelete().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::readAndDelete | ( | string | $path | ) |
Reads the entire file content into a string and removes the file afterwards.
string | $path | The file which should be red and removed. |
FileNotFoundException | If the file was not found. |
IOException | If the file could not red or deleted. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 288 of file FlySystemFileAccess.php.
References $path, and ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\read().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::rename | ( | string | $path, |
string | $new_path | ||
) |
Moves a file from the source to the destination.
string | $path | The current path of the file which should be moved. |
string | $new_path | The new path of the file. |
FileNotFoundException | If the source file is not found. |
FileAlreadyExistsException | If the destination file is already existing. |
IOException | If the file could not be moved. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 308 of file FlySystemFileAccess.php.
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::setVisibility | ( | string | $path, |
string | $visibility | ||
) |
Sets the visibility for a file.
Please note that the $visibility must 'public' or 'private'.
The Visibility interface provides two constants PUBLIC_ACCESS and PRIVATE_ACCESS. We strongly encourage the consumers of this API to use the constants.
Implements ILIAS\Filesystem\Provider\FileReadAccess.
Definition at line 118 of file FlySystemFileAccess.php.
References ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\has(), and ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\validateVisibility().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::update | ( | string | $path, |
string | $new_content | ||
) |
Updates the content of a file.
Replaces the file content with a new one.
string | $path | The path to the file which should be updated. |
string | $new_content | The new file content. |
FileNotFoundException | If the file is not found. |
IOException | If the file could not be updated. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 220 of file FlySystemFileAccess.php.
Referenced by ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\put().
|
private |
Checks if the given visibility is valid an throws an exception otherwise.
If the visibility is valid no further actions are taken.
string | $visibility | The visibility which should be validated. |
Definition at line 142 of file FlySystemFileAccess.php.
References ILIAS\Filesystem\Visibility\PRIVATE_ACCESS, and ILIAS\Filesystem\Visibility\PUBLIC_ACCESS.
Referenced by ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\setVisibility().
ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess::write | ( | string | $path, |
string | $content | ||
) |
Writes the content to a new file.
string | $path | The path to the file which should be created. |
string | $content | The content which should be written to the new file. |
FileAlreadyExistsException | If the file already exists. |
IOException | If the file could not be created or written. |
Implements ILIAS\Filesystem\Provider\FileWriteAccess.
Definition at line 194 of file FlySystemFileAccess.php.
Referenced by ILIAS\Filesystem\Provider\FlySystem\FlySystemFileAccess\put().