IStorage
in
Provide a common interface to all different storage options
All paths passed to the storage are relative to the storage and should NOT have a leading slash.
Tags
Table of Contents
Methods
- copy() : bool
- see https://www.php.net/manual/en/function.copy.php
- copyFromStorage() : bool
- file_exists() : bool
- see https://www.php.net/manual/en/function.file-exists.php
- file_get_contents() : string|false
- see https://www.php.net/manual/en/function.file-get-contents.php
- file_put_contents() : int|float|false
- see https://www.php.net/manual/en/function.file-put-contents.php
- filemtime() : int|false
- see https://www.php.net/manual/en/function.filemtime.php
- filesize() : int|float|false
- see https://www.php.net/manual/en/function.filesize.php The result for filesize when called on a folder is required to be 0
- filetype() : string|false
- see https://www.php.net/manual/en/function.filetype.php
- fopen() : resource|false
- see https://www.php.net/manual/en/function.fopen.php
- free_space() : int|float|false
- see https://www.php.net/manual/en/function.disk-free-space.php
- getAvailability() : array<string|int, mixed>
- getCache() : ICache
- getDirectDownload() : array<string|int, mixed>|false
- A custom storage implementation can return an url for direct download of a give file.
- getETag() : string|false
- get the ETag for a file or folder
- getId() : string
- Get the identifier for the storage, the returned id should be the same for every storage object that is created with the same parameters and two storage objects with the same id should refer to two storages that display the same files.
- getLocalFile() : string|false
- get the path to a local version of the file.
- getMimeType() : string|false
- get the mimetype for a file or folder The mimetype for a folder is required to be "httpd/unix-directory"
- getOwner() : string|false
- getPermissions() : int
- get the full permissions of a path.
- getPropagator() : IPropagator
- getScanner() : IScanner
- getUpdater() : IUpdater
- getWatcher() : IWatcher
- hash() : string|false
- see https://www.php.net/manual/en/function.hash-file.php
- hasUpdated() : bool
- check if a file or folder has been updated since $time
- instanceOfStorage() : bool
- Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
- is_dir() : bool
- see https://www.php.net/manual/en/function.is-dir.php
- is_file() : bool
- see https://www.php.net/manual/en/function.is-file.php
- isCreatable() : bool
- check if a file can be created in $path
- isDeletable() : bool
- check if a file can be deleted
- isLocal() : bool
- Returns whether the storage is local, which means that files are stored on the local filesystem instead of remotely.
- isReadable() : bool
- check if a file can be read
- isSharable() : bool
- check if a file can be shared
- isUpdatable() : bool
- check if a file can be written to
- mkdir() : bool
- see https://www.php.net/manual/en/function.mkdir.php implementations need to implement a recursive mkdir
- moveFromStorage() : bool
- needsPartFile() : bool
- opendir() : resource|false
- see https://www.php.net/manual/en/function.opendir.php
- rename() : bool
- see https://www.php.net/manual/en/function.rename.php
- rmdir() : bool
- see https://www.php.net/manual/en/function.rmdir.php
- setAvailability() : void
- setOwner() : void
- Allow setting the storage owner
- stat() : array<string|int, mixed>|false
- see https://www.php.net/manual/en/function.stat.php only the following keys are required in the result: size and mtime
- test() : bool
- Test a storage for availability
- touch() : bool
- see https://www.php.net/manual/en/function.touch.php If the backend does not support the operation, false should be returned
- unlink() : bool
- see https://www.php.net/manual/en/function.unlink.php
- verifyPath() : void
Methods
copy()
see https://www.php.net/manual/en/function.copy.php
public
copy(string $source, string $target) : bool
Parameters
- $source : string
- $target : string
Tags
Return values
boolcopyFromStorage()
public
copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath) : bool
Parameters
- $sourceStorage : IStorage
- $sourceInternalPath : string
- $targetInternalPath : string
Tags
Return values
boolfile_exists()
see https://www.php.net/manual/en/function.file-exists.php
public
file_exists(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolfile_get_contents()
see https://www.php.net/manual/en/function.file-get-contents.php
public
file_get_contents(string $path) : string|false
Parameters
- $path : string
Tags
Return values
string|falsefile_put_contents()
see https://www.php.net/manual/en/function.file-put-contents.php
public
file_put_contents(string $path, mixed $data) : int|float|false
Parameters
- $path : string
- $data : mixed
Tags
Return values
int|float|falsefilemtime()
see https://www.php.net/manual/en/function.filemtime.php
public
filemtime(string $path) : int|false
Parameters
- $path : string
Tags
Return values
int|falsefilesize()
see https://www.php.net/manual/en/function.filesize.php The result for filesize when called on a folder is required to be 0
public
filesize(string $path) : int|float|false
Parameters
- $path : string
Tags
Return values
int|float|falsefiletype()
see https://www.php.net/manual/en/function.filetype.php
public
filetype(string $path) : string|false
Parameters
- $path : string
Tags
Return values
string|falsefopen()
see https://www.php.net/manual/en/function.fopen.php
public
fopen(string $path, string $mode) : resource|false
Parameters
- $path : string
- $mode : string
Tags
Return values
resource|falsefree_space()
see https://www.php.net/manual/en/function.disk-free-space.php
public
free_space(string $path) : int|float|false
Parameters
- $path : string
Tags
Return values
int|float|falsegetAvailability()
public
getAvailability() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —[ available, last_checked ]
getCache()
public
getCache([string $path = '' ][, IStorage|null $storage = null ]) : ICache
Parameters
- $path : string = ''
- $storage : IStorage|null = null
Tags
Return values
ICachegetDirectDownload()
A custom storage implementation can return an url for direct download of a give file.
public
getDirectDownload(string $path) : array<string|int, mixed>|false
For now the returned array can hold the parameter url - in future more attributes might follow.
Parameters
- $path : string
Tags
Return values
array<string|int, mixed>|falsegetETag()
get the ETag for a file or folder
public
getETag(string $path) : string|false
Parameters
- $path : string
Tags
Return values
string|falsegetId()
Get the identifier for the storage, the returned id should be the same for every storage object that is created with the same parameters and two storage objects with the same id should refer to two storages that display the same files.
public
getId() : string
Tags
Return values
stringgetLocalFile()
get the path to a local version of the file.
public
getLocalFile(string $path) : string|false
The local version of the file can be temporary and doesn't have to be persistent across requests
Parameters
- $path : string
Tags
Return values
string|falsegetMimeType()
get the mimetype for a file or folder The mimetype for a folder is required to be "httpd/unix-directory"
public
getMimeType(string $path) : string|false
Parameters
- $path : string
Tags
Return values
string|falsegetOwner()
public
getOwner(string $path) : string|false
Parameters
- $path : string
Tags
Return values
string|falsegetPermissions()
get the full permissions of a path.
public
getPermissions(string $path) : int
Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php
Parameters
- $path : string
Tags
Return values
intgetPropagator()
public
getPropagator() : IPropagator
Tags
Return values
IPropagatorgetScanner()
public
getScanner() : IScanner
Tags
Return values
IScannergetUpdater()
public
getUpdater() : IUpdater
Tags
Return values
IUpdatergetWatcher()
public
getWatcher() : IWatcher
Tags
Return values
IWatcherhash()
see https://www.php.net/manual/en/function.hash-file.php
public
hash(string $type, string $path[, bool $raw = false ]) : string|false
Parameters
- $type : string
- $path : string
- $raw : bool = false
Tags
Return values
string|falsehasUpdated()
check if a file or folder has been updated since $time
public
hasUpdated(string $path, int $time) : bool
Parameters
- $path : string
- $time : int
Tags
Return values
boolinstanceOfStorage()
Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
public
instanceOfStorage(string $class) : bool
Parameters
- $class : string
Tags
Return values
boolis_dir()
see https://www.php.net/manual/en/function.is-dir.php
public
is_dir(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolis_file()
see https://www.php.net/manual/en/function.is-file.php
public
is_file(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolisCreatable()
check if a file can be created in $path
public
isCreatable(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolisDeletable()
check if a file can be deleted
public
isDeletable(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolisLocal()
Returns whether the storage is local, which means that files are stored on the local filesystem instead of remotely.
public
isLocal() : bool
Calling getLocalFile() for local storages should always return the local files, whereas for non-local storages it might return a temporary file.
Tags
Return values
bool —true if the files are stored locally, false otherwise
isReadable()
check if a file can be read
public
isReadable(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolisSharable()
check if a file can be shared
public
isSharable(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolisUpdatable()
check if a file can be written to
public
isUpdatable(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolmkdir()
see https://www.php.net/manual/en/function.mkdir.php implementations need to implement a recursive mkdir
public
mkdir(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolmoveFromStorage()
public
moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath) : bool
Parameters
- $sourceStorage : IStorage
- $sourceInternalPath : string
- $targetInternalPath : string
Tags
Return values
boolneedsPartFile()
public
needsPartFile() : bool
Tags
Return values
boolopendir()
see https://www.php.net/manual/en/function.opendir.php
public
opendir(string $path) : resource|false
Parameters
- $path : string
Tags
Return values
resource|falserename()
see https://www.php.net/manual/en/function.rename.php
public
rename(string $source, string $target) : bool
Parameters
- $source : string
- $target : string
Tags
Return values
boolrmdir()
see https://www.php.net/manual/en/function.rmdir.php
public
rmdir(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolsetAvailability()
public
setAvailability(bool $isAvailable) : void
Parameters
- $isAvailable : bool
Tags
setOwner()
Allow setting the storage owner
public
setOwner(string|null $user) : void
This can be used for storages that do not have a dedicated owner, where we want to pass the user that we setup the mountpoint for along to the storage layer
Parameters
- $user : string|null
-
Owner user id
Tags
stat()
see https://www.php.net/manual/en/function.stat.php only the following keys are required in the result: size and mtime
public
stat(string $path) : array<string|int, mixed>|false
Parameters
- $path : string
Tags
Return values
array<string|int, mixed>|falsetest()
Test a storage for availability
public
test() : bool
Tags
Return values
booltouch()
see https://www.php.net/manual/en/function.touch.php If the backend does not support the operation, false should be returned
public
touch(string $path[, int|null $mtime = null ]) : bool
Parameters
- $path : string
- $mtime : int|null = null
Tags
Return values
boolunlink()
see https://www.php.net/manual/en/function.unlink.php
public
unlink(string $path) : bool
Parameters
- $path : string
Tags
Return values
boolverifyPath()
public
verifyPath(string $path, string $fileName) : void
Parameters
- $path : string
- $fileName : string