Skip to content

File

This is an ACL-enabled file node.

Properties

acl

A list of ACL rules.

protected array $acl

owner

Owner uri, or null for no owner.

protected string|null $owner

Methods

__construct

Constructor.

public __construct(string $path, array $acl, string|null $owner = null): mixed

Parameters:

Parameter Type Description
$path string on-disk path
$acl array ACL rules
$owner string|null principal owner string

getOwner

Returns the owner principal.

public getOwner(): string|null

This must be a url to a principal, or null if there's no owner


getACL

Returns a list of ACE's for this node.

public getACL(): array

Each ACE has the following properties: * 'privilege', a string such as {DAV:}read or {DAV:}write. These are currently the only supported privileges * 'principal', a url to the principal who owns the node * 'protected' (optional), indicating that this ACE is not allowed to be updated.


Inherited methods

__construct

Sets up the node, expects a full path name.

public __construct(string $path, string $overrideName = null): mixed

If $overrideName is set, this node shows up in the tree under a different name. In this case setName() will be disabled.

Parameters:

Parameter Type Description
$path string
$overrideName string

getName

Returns the name of the node.

public getName(): string

setName

Renames the node.

public setName(string $name): mixed

Parameters:

Parameter Type Description
$name string The new name

getLastModified

Returns the last modification time, as a unix timestamp.

public getLastModified(): int

put

Updates the data.

public put(resource|string $data): string

Data is a readable stream resource.

Parameters:

Parameter Type Description
$data resource|string

patch

Updates the file based on a range specification.

public patch(resource|string $data, int $rangeType, int $offset = null): string|null

The first argument is the data, which is either a readable stream resource or a string.

The second argument is the type of update we're doing. This is either: * 1. append (default) * 2. update based on a start byte * 3. update based on an end byte ; The third argument is the start or end byte.

After a successful put operation, you may choose to return an ETag. The ETAG must always be surrounded by double-quotes. These quotes must appear in the actual string you're returning.

Clients may use the ETag from a PUT request to later on make sure that when they update the file, the contents haven't changed in the mean time.

Parameters:

Parameter Type Description
$data resource|string
$rangeType int
$offset int

get

Returns the data.

public get(): resource

delete

Delete the current file.

public delete(): bool

getETag

Returns the ETag for a file.

public getETag(): string|null

An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. The ETag is an arbitrary string, but MUST be surrounded by double-quotes.

Return null if the ETag can not effectively be determined


getContentType

Returns the mime-type for a file.

public getContentType(): string|null

If null is returned, we'll assume application/octet-stream


getSize

Returns the size of the file, in bytes.

public getSize(): int

getOwner

Returns the owner principal.

public getOwner(): string|null

This must be a url to a principal, or null if there's no owner


getGroup

Returns a group principal.

public getGroup(): string|null

This must be a url to a principal, or null if there's no owner


getACL

Returns a list of ACE's for this node.

public getACL(): array

Each ACE has the following properties: * 'privilege', a string such as {DAV:}read or {DAV:}write. These are currently the only supported privileges * 'principal', a url to the principal who owns the node * 'protected' (optional), indicating that this ACE is not allowed to be updated.


setACL

Updates the ACL.

public setACL(array $acl): mixed

This method will receive a list of new ACE's as an array argument.

Parameters:

Parameter Type Description
$acl array

getSupportedPrivilegeSet

Returns the list of supported privileges for this node.

public getSupportedPrivilegeSet(): array|null

The returned data structure is a list of nested privileges. See Sabre\DAVACL\Plugin::getDefaultSupportedPrivilegeSet for a simple standard structure.

If null is returned from this method, the default privilege set is used, which is fine for most common usecases.



Automatically generated on 2025-03-18