Nextcloud PHP API (master)

IFileAccess

Low level access to the file cache.

This is intended for use cases where data from the filecache needs to be loaded, but the full filesystem apis are insufficient or too inefficient for the use-case.

Tags
since
29.0.0

Table of Contents

Methods

getByAncestorInStorage()  : Generator<string|int, ICacheEntry>
Retrieves files stored in a specific storage that have a specified ancestor in the file hierarchy.
getByFileId()  : ICacheEntry|null
Get a filecache data by file id.
getByFileIdInStorage()  : ICacheEntry|null
Get a filecache data by file id from a specific storage.
getByFileIds()  : array<int, ICacheEntry>
Get filecache data by file ids.
getByFileIdsInStorage()  : array<int, ICacheEntry>
Get filecache data by file ids from a specific storage.
getByPathInStorage()  : ICacheEntry|null
Get a filecache data by path and storage id.
getDistinctMounts()  : Generator<string|int, array{storage_id: int, root_id: int, overridden_root: int}>
Retrieves a list of all distinct mounts.

Methods

getByAncestorInStorage()

Retrieves files stored in a specific storage that have a specified ancestor in the file hierarchy.

public getByAncestorInStorage(int $storageId, int $folderId[, int $fileIdCursor = 0 ][, int $maxResults = 100 ][, array<int, int> $mimeTypeIds = [] ][, bool $endToEndEncrypted = true ][, bool $serverSideEncrypted = true ]) : Generator<string|int, ICacheEntry>

Allows filtering by mime types, encryption status, and limits the number of results.

Parameters
$storageId : int

The ID of the storage to search within.

$folderId : int

The file ID of the ancestor to base the search on.

$fileIdCursor : int = 0

The last processed file ID. Only files with a higher ID will be included. Defaults to 0.

$maxResults : int = 100

The maximum number of results to retrieve. If set to 0, all matching files will be retrieved.

$mimeTypeIds : array<int, int> = []

An array of mime types to filter the results. If empty, no mime type filtering will be applied.

$endToEndEncrypted : bool = true

Whether to include EndToEndEncrypted files

$serverSideEncrypted : bool = true

Whether to include ServerSideEncrypted files

Tags
throws
Exception
since
32.0.0
Return values
Generator<string|int, ICacheEntry>

A generator yielding matching files as cache entries.

getByFileId()

Get a filecache data by file id.

public getByFileId(int $fileId) : ICacheEntry|null

If the storage id is known then getByFileIdInStorage is preferred as it can be more efficient in some setups.

Parameters
$fileId : int
Tags
since
29.0.0
Return values
ICacheEntry|null

getByFileIdInStorage()

Get a filecache data by file id from a specific storage.

public getByFileIdInStorage(int $fileId, int $storageId) : ICacheEntry|null

This is preferred over getByFileId when the storage id is known as it can be more efficient in some setups.

Parameters
$fileId : int
$storageId : int
Tags
since
29.0.0
Return values
ICacheEntry|null

getByFileIds()

Get filecache data by file ids.

public getByFileIds(array<string|int, int> $fileIds) : array<int, ICacheEntry>

If the storage id is known then getByFileIdsInStorage is preferred as it can be more efficient in some setups.

Parameters
$fileIds : array<string|int, int>
Tags
since
29.0.0
Return values
array<int, ICacheEntry>

getByFileIdsInStorage()

Get filecache data by file ids from a specific storage.

public getByFileIdsInStorage(array<string|int, int> $fileIds, int $storageId) : array<int, ICacheEntry>

This is prefered over getByFileIds when the storage id is known as it can be more efficient in some setups.

Parameters
$fileIds : array<string|int, int>
$storageId : int
Tags
since
29.0.0
Return values
array<int, ICacheEntry>

getByPathInStorage()

Get a filecache data by path and storage id.

public getByPathInStorage(string $path, int $storageId) : ICacheEntry|null
Parameters
$path : string
$storageId : int
Tags
since
29.0.0
Return values
ICacheEntry|null

getDistinctMounts()

Retrieves a list of all distinct mounts.

public getDistinctMounts([array<int, string> $mountProviders = [] ][, bool $onlyUserFilesMounts = true ]) : Generator<string|int, array{storage_id: int, root_id: int, overridden_root: int}>

Allows filtering by specific mount providers. Optionally rewrites home directory root paths to avoid cache and trashbin.

Parameters
$mountProviders : array<int, string> = []

An array of mount provider class names to filter. If empty, all providers will be included.

$onlyUserFilesMounts : bool = true

Whether to rewrite the root IDs for home directories to only include user files and to only consider mounts with mount points in the user files.

Tags
throws
Exception
since
32.0.0
Return values
Generator<string|int, array{storage_id: int, root_id: int, overridden_root: int}>

A generator yielding mount configurations as an array containing 'storage_id', 'root_id', and 'override_root'.


        
On this page

Search results