Documentation

File extends File
in package
implements IACL Uses ACLTrait

This is an ACL-enabled file node.

Tags
copyright

Copyright (C) fruux GmbH (https://fruux.com/)

author

Evert Pot (http://evertpot.com/)

license

http://sabre.io/license/ Modified BSD License

Interfaces, Classes and Traits

IACL
ACL-enabled node.

Table of Contents

$acl  : array<string|int, mixed>
A list of ACL rules.
$overrideName  : string
The overridden name of the node.
$owner  : string|null
Owner uri, or null for no owner.
$path  : string
The path to the current node.
__construct()  : mixed
Constructor.
delete()  : bool
Delete the current file.
get()  : resource
Returns the data.
getACL()  : array<string|int, mixed>
Returns a list of ACE's for this node.
getContentType()  : string|null
Returns the mime-type for a file.
getETag()  : string|null
Returns the ETag for a file.
getGroup()  : string|null
Returns a group principal.
getLastModified()  : int
Returns the last modification time, as a unix timestamp.
getName()  : string
Returns the name of the node.
getOwner()  : string|null
Returns the owner principal.
getSize()  : int
Returns the size of the file, in bytes.
getSupportedPrivilegeSet()  : array<string|int, mixed>|null
Returns the list of supported privileges for this node.
patch()  : string|null
Updates the file based on a range specification.
put()  : string
Updates the data.
setACL()  : mixed
Updates the ACL.
setName()  : mixed
Renames the node.

Properties

$acl

A list of ACL rules.

protected array<string|int, mixed> $acl

$overrideName

The overridden name of the node.

protected string $overrideName

$owner

Owner uri, or null for no owner.

protected string|null $owner

$path

The path to the current node.

protected string $path

Methods

__construct()

Constructor.

public __construct(string $path, array<string|int, mixed> $acl[, string|null $owner = null ]) : mixed
Parameters
$path : string

on-disk path

$acl : array<string|int, mixed>

ACL rules

$owner : string|null = null

principal owner string

Return values
mixed

delete()

Delete the current file.

public delete() : bool
Return values
bool

get()

Returns the data.

public get() : resource
Return values
resource

getACL()

Returns a list of ACE's for this node.

public getACL() : array<string|int, mixed>

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.
Return values
array<string|int, mixed>

getContentType()

Returns the mime-type for a file.

public getContentType() : string|null

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

Return values
string|null

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

Return values
string|null

getGroup()

Returns a group principal.

public getGroup() : string|null

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

Return values
string|null

getLastModified()

Returns the last modification time, as a unix timestamp.

public getLastModified() : int
Return values
int

getName()

Returns the name of the node.

public getName() : string
Return values
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

Return values
string|null

getSize()

Returns the size of the file, in bytes.

public getSize() : int
Return values
int

getSupportedPrivilegeSet()

Returns the list of supported privileges for this node.

public getSupportedPrivilegeSet() : array<string|int, mixed>|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.

Return values
array<string|int, mixed>|null

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
    1. update based on a start byte
    1. 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
$data : resource|string
$rangeType : int
$offset : int = null
Return values
string|null

put()

Updates the data.

public put(resource|string $data) : string

Data is a readable stream resource.

Parameters
$data : resource|string
Return values
string

setACL()

Updates the ACL.

public setACL(array<string|int, mixed> $acl) : mixed

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

Parameters
$acl : array<string|int, mixed>
Return values
mixed

setName()

Renames the node.

public setName(string $name) : mixed
Parameters
$name : string

The new name

Return values
mixed

Search results