A wrapper around Flysystem that implements Elgg's filesystem API.
More...
|
| __construct (Filesystem $filesystem, $local_path= '', $chroot= '') |
| Use one of the static factory functions to create an instance. More...
|
|
| chroot ($path) |
| Returns a subdirectory with access limited to the given directory.- Parameters
-
string | $path | The path relative to this directory to chroot to. |
- Returns
- Directory A new directory instance.
- Exceptions
-
More...
|
|
| isFile ($path) |
| Whether this directory has an existing file at the given location.- Parameters
-
string | $path | The relative path within this directory |
- Returns
- boolean
- Exceptions
-
More...
|
|
| getContents ($path) |
| Read the file off the filesystem.- Parameters
-
string | $path | The directory-relative path to the target file. |
- Returns
- string Empty string if the file doesn't exist.
- Exceptions
-
More...
|
|
| getFile ($path) |
| A reference to the file at the given path, even if it doesn't exist yet.However, will throw an exception if the file is already a directory.- Parameters
-
string | $path | The path to the file, relative to this directory. |
- Returns
- File
- Exceptions
-
More...
|
|
| getFiles ($path= '', $recursive=true) |
| List the files in the given directory path.- Parameters
-
string | $path | The subdirectory path within this directory |
bool | $recursive | Find files recursively |
- Returns
- <File>
- Exceptions
-
More...
|
|
| getDirectories ($path= '', $recursive=true) |
| List the directories in the given directory path.- Parameters
-
string | $path | The subdirectory path within this directory |
bool | $recursive | Find directories recursively |
- Returns
- <Directory>
- Exceptions
-
More...
|
|
| getPath ($path= '') |
| Get the absolute path to the given directory-relative path.- Parameters
-
string | $path | A file/directory path within this directory. |
- Returns
- string
- Exceptions
-
More...
|
|
| includeFile ($path) |
| Do a PHP include of the file and return the result.NB: This only really works with local filesystems amirite?- Parameters
-
string | $path | Filesystem-relative path for the file to include. |
- Returns
- mixed
- Exceptions
-
More...
|
|
| putContents ($path, $content) |
| Write a file, overwriting the contents if necessary.- Parameters
-
string | $path | The path to the file. |
string | $content | The literal text content of the file. |
- Returns
- void
- Exceptions
-
More...
|
|
|
| getEntries ($path= '', $recursive=true, $types=['file', 'dir']) |
| List the files and directories in the given directory path. More...
|
|
A wrapper around Flysystem that implements Elgg's filesystem API.
- Since
- 1.10.0
Definition at line 20 of file Fly.php.
Elgg\Filesystem\Directory\Fly::__construct |
( |
Filesystem |
$filesystem, |
|
|
|
$local_path = '' , |
|
|
|
$chroot = '' |
|
) |
| |
Use one of the static factory functions to create an instance.
- Parameters
-
Filesystem | $filesystem | The underlying filesystem implementation. It must have the 'ListFiles' plugin. |
string | $local_path | Only applicable for local filesystem. |
string | $chroot | Path relative to the underlying filesystem root. |
Definition at line 44 of file Fly.php.
Elgg\Filesystem\Directory\Fly::chroot |
( |
|
$path | ) |
|
Returns a subdirectory with access limited to the given directory.
- Parameters
-
string | $path | The path relative to this directory to chroot to. |
- Returns
- Directory A new directory instance.
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 53 of file Fly.php.
static Elgg\Filesystem\Directory\Fly::createInMemory |
( |
| ) |
|
|
static |
Shorthand for generating a new in-memory-only filesystem.
- Returns
- Directory
Definition at line 189 of file Fly.php.
static Elgg\Filesystem\Directory\Fly::createLocal |
( |
|
$path | ) |
|
|
static |
Shorthand for generating a new local filesystem.
- Parameters
-
string | $path | absolute path to directory on local filesystem. |
- Returns
- Directory
Definition at line 179 of file Fly.php.
Elgg\Filesystem\Directory\Fly::getContents |
( |
|
$path | ) |
|
Read the file off the filesystem.
- Parameters
-
string | $path | The directory-relative path to the target file. |
- Returns
- string Empty string if the file doesn't exist.
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 79 of file Fly.php.
Elgg\Filesystem\Directory\Fly::getDirectories |
( |
|
$path = '' , |
|
|
|
$recursive = true |
|
) |
| |
List the directories in the given directory path.
- Parameters
-
string | $path | The subdirectory path within this directory |
bool | $recursive | Find directories recursively |
- Returns
- <Directory>
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 106 of file Fly.php.
Elgg\Filesystem\Directory\Fly::getEntries |
( |
|
$path = '' , |
|
|
|
$recursive = true , |
|
|
|
$types = ['file' , |
|
|
'dir'] |
|
|
) |
| |
|
protected |
List the files and directories in the given directory path.
- Parameters
-
string | $path | The subdirectory path within this directory |
bool | $recursive | Find files and directories recursively |
| string[] | $types Entry types to return ('file' and/or 'dir') |
- Returns
- Collection<File|Directory>
Definition at line 119 of file Fly.php.
Elgg\Filesystem\Directory\Fly::getFile |
( |
|
$path | ) |
|
A reference to the file at the given path, even if it doesn't exist yet.However, will throw an exception if the file is already a directory.
- Parameters
-
string | $path | The path to the file, relative to this directory. |
- Returns
- File
- Exceptions
-
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 88 of file Fly.php.
Elgg\Filesystem\Directory\Fly::getFiles |
( |
|
$path = '' , |
|
|
|
$recursive = true |
|
) |
| |
List the files in the given directory path.
- Parameters
-
string | $path | The subdirectory path within this directory |
bool | $recursive | Find files recursively |
- Returns
- <File>
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 99 of file Fly.php.
Elgg\Filesystem\Directory\Fly::getPath |
( |
|
$path = '' | ) |
|
Get the absolute path to the given directory-relative path.
- Parameters
-
string | $path | A file/directory path within this directory. |
- Returns
- string
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 141 of file Fly.php.
Elgg\Filesystem\Directory\Fly::includeFile |
( |
|
$path | ) |
|
Do a PHP include of the file and return the result.NB: This only really works with local filesystems amirite?
- Parameters
-
string | $path | Filesystem-relative path for the file to include. |
- Returns
- mixed
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 161 of file Fly.php.
Elgg\Filesystem\Directory\Fly::isFile |
( |
|
$path | ) |
|
Whether this directory has an existing file at the given location.
- Parameters
-
string | $path | The relative path within this directory |
- Returns
- boolean
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 72 of file Fly.php.
Elgg\Filesystem\Directory\Fly::putContents |
( |
|
$path, |
|
|
|
$content |
|
) |
| |
Write a file, overwriting the contents if necessary.
- Parameters
-
string | $path | The path to the file. |
string | $content | The literal text content of the file. |
- Returns
- void
- Exceptions
-
Implements Elgg\Filesystem\Directory.
Definition at line 168 of file Fly.php.
The documentation for this class was generated from the following file:
- engine/classes/Elgg/Filesystem/Directory/Fly.php