Nextcloud PHP API (master)

IReliableEtagStorage extends IStorage

Marks a storage as providing reliable etags according to expected behavior of etags within nextcloud:

  • Etag are stable as long as no changes are made to the files
  • Changes inside a folder cause etag changes of the parent folders
Tags
since
24.0.0

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
since
9.0.0
Return values
bool

copyFromStorage()

public copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath) : bool
Parameters
$sourceStorage : IStorage
$sourceInternalPath : string
$targetInternalPath : string
Tags
since
9.0.0
Return values
bool

file_exists()

see https://www.php.net/manual/en/function.file-exists.php

public file_exists(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

file_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
since
9.0.0
Return values
string|false

file_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
since
9.0.0
Return values
int|float|false

filemtime()

see https://www.php.net/manual/en/function.filemtime.php

public filemtime(string $path) : int|false
Parameters
$path : string
Tags
since
9.0.0
Return values
int|false

filesize()

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
since
9.0.0
Return values
int|float|false

filetype()

see https://www.php.net/manual/en/function.filetype.php

public filetype(string $path) : string|false
Parameters
$path : string
Tags
since
9.0.0
Return values
string|false

fopen()

see https://www.php.net/manual/en/function.fopen.php

public fopen(string $path, string $mode) : resource|false
Parameters
$path : string
$mode : string
Tags
since
9.0.0
Return values
resource|false

free_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
since
9.0.0
Return values
int|float|false

getAvailability()

public getAvailability() : array<string|int, mixed>
Tags
since
9.0.0
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
since
9.0.0
Return values
ICache

getDirectDownload()

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
since
9.0.0
Return values
array<string|int, mixed>|false

getETag()

get the ETag for a file or folder

public getETag(string $path) : string|false
Parameters
$path : string
Tags
since
9.0.0
Return values
string|false

getId()

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
since
9.0.0
Return values
string

getLocalFile()

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
since
9.0.0
Return values
string|false

getMimeType()

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
since
9.0.0
Return values
string|false

getOwner()

public getOwner(string $path) : string|false
Parameters
$path : string
Tags
since
9.0.0
Return values
string|false

getPermissions()

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
since
9.0.0
Return values
int

hash()

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
since
9.0.0
Return values
string|false

hasUpdated()

check if a file or folder has been updated since $time

public hasUpdated(string $path, int $time) : bool
Parameters
$path : string
$time : int
Tags
since
9.0.0

hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. returning true for other changes in the folder is optional

Return values
bool

instanceOfStorage()

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
template

T of IStorage

psalm-param

class-string<T> $class

since
9.0.0
psalm-assert-if-true

T $this

Return values
bool

is_dir()

see https://www.php.net/manual/en/function.is-dir.php

public is_dir(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

is_file()

see https://www.php.net/manual/en/function.is-file.php

public is_file(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

isCreatable()

check if a file can be created in $path

public isCreatable(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

isDeletable()

check if a file can be deleted

public isDeletable(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

isLocal()

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
since
9.0.0
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
since
9.0.0
Return values
bool

isSharable()

check if a file can be shared

public isSharable(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

isUpdatable()

check if a file can be written to

public isUpdatable(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

mkdir()

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
since
9.0.0
Return values
bool

moveFromStorage()

public moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath) : bool
Parameters
$sourceStorage : IStorage
$sourceInternalPath : string
$targetInternalPath : string
Tags
since
9.0.0
Return values
bool

needsPartFile()

public needsPartFile() : bool
Tags
since
12.0.0
since
31.0.0

moved from Storage to IStorage

Return values
bool

opendir()

see https://www.php.net/manual/en/function.opendir.php

public opendir(string $path) : resource|false
Parameters
$path : string
Tags
since
9.0.0
Return values
resource|false

rename()

see https://www.php.net/manual/en/function.rename.php

public rename(string $source, string $target) : bool
Parameters
$source : string
$target : string
Tags
since
9.0.0
Return values
bool

rmdir()

see https://www.php.net/manual/en/function.rmdir.php

public rmdir(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

setAvailability()

public setAvailability(bool $isAvailable) : void
Parameters
$isAvailable : bool
Tags
since
9.0.0

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
since
30.0.0

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
since
9.0.0
Return values
array<string|int, mixed>|false

test()

Test a storage for availability

public test() : bool
Tags
since
9.0.0
Return values
bool

touch()

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
since
9.0.0
Return values
bool

see https://www.php.net/manual/en/function.unlink.php

public unlink(string $path) : bool
Parameters
$path : string
Tags
since
9.0.0
Return values
bool

verifyPath()

public verifyPath(string $path, string $fileName) : void
Parameters
$path : string
$fileName : string
Tags
throws
InvalidPathException
since
9.0.0

        
On this page

Search results