class FilesApp extends InstalledApp

App that provides user-facing filesystem services.

Provides a general filesystem API for managing files and folders, as well as admin-level functions like managing filesystems and config.

Supports features like random-level byte access, multiple (user or admin-added) filesystems with various backend storage drivers, social features including likes and comments, sharing of content via links or to users or groups, configurable rules per-account or per-filesystem, and granular statistics gathering and limiting for accounts/groups/filesystems.

Properties

protected $API

Reference to the main API, for convenience

from  BaseApp
static private $metadata from  BaseApp
protected $config from  InstalledApp
protected $database from  InstalledApp

Methods

__construct(Main $API)

All apps are constructed when Andromeda runs

mixed
Run(Input $input)

Checks if the client is running/needs to run install/upgrade {@inheritDoc}

static array
getUsage()

Returns an array of strings showing the CLI usage of the app

static string
getName()

No description

static string|null
getLogClass()

Return this app's BaseAppLog class name, if used (or null)

static 
getMetadata(string $app, string $key)

Loads a metadata for the given app with the given key

from  BaseApp
static array
getAppRequires(string $app)

No description

from  BaseApp
static string
getAppApiVersion(string $app)

No description

from  BaseApp
static string
getVersion()

No description

from  BaseApp
commit()

Tells the app to commit any changes made outside the database

rollback()

Tells the app to rollback any changes made outside the database

static string
getInstallFlags()

No description

static string
getUpgradeFlags()

No description

static array
getInstallUsage()

No description

static string
getConfigClass()

Return the BaseConfig class for this app

bool
allowInstall()

Returns true if the user is allowed to install/upgrade

static string
getTemplateFolder()

Returns the path of the app's code folder

static array
getUpgradeScripts()

No description

Install(Input $input)

Installs the app by importing its SQL file and creating config

Upgrade(Input $input)

Iterates over the list of upgrade scripts, running them sequentially until the DB is up to date with the code

GetConfig()

No description

AuthenticateFileAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string|null $id = null)

Returns an ItemAccess authenticating the given file ID (or null to get from input), throws exceptions on failure

AuthenticateFolderAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string|null $id = null, bool $isParent = false)

Returns an ItemAccess authenticating the given folder ID (or null to get from input), throws exceptions on failure

ItemAccess|null
TryAuthenticateFolderAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string|null $id = null, bool $isParent = false)

Returns an ItemAccess authenticating the given folder ID (or null to get from input), returns null on failure

static void
UnknownItemException(string|null $class = null)

Throws an unknown file/folder exception if given, else item exception

AuthenticateItemAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string $class, string|null $id, bool $isParent = false)

Returns an ItemAccess authenticating the given item class/ID, throws exceptions on failure

ItemAccess|null
TryAuthenticateItemAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string $class, string|null $id, bool $isParent = false)

Returns an ItemAccess authenticating the given item class/ID, returns null on failure

AuthenticateItemObjAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, Item $item, bool $isParent = false)

Returns an ItemAccess authenticating the given already-loaded object

array
RunGetConfig(Input $input, Authenticator|null $authenticator)

Gets config for this app

array
RunSetConfig(Input $input, Authenticator|null $authenticator)

Sets config for this app

array
UploadFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Uploads a new file to the given folder. Bandwidth is counted.

void
DownloadFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Downloads a file or part of a file

array
WriteToFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Writes new data to an existing file - data is posted as a file

array
TruncateFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Truncates (resizes a file)

array
GetFileMeta(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Returns file metadata

array
GetFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Lists folder metadata and optionally the items in a folder (or filesystem root)

array
GetItemByPath(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Reads an item by a path (rather than by ID) - can specify a root folder or filesystem

array|null
EditFileMeta(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Edits file metadata

array|null
EditFolderMeta(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Edits folder metadata

array
EditItemMeta(ItemAccess $access, Input $input)

Edits item metadata

array
OwnFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Takes ownership of a file

array
OwnFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Takes ownership of a folder

array
CreateFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates a folder in the given parent

void
DeleteFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes a file

void
DeleteFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes a folder

void
DeleteItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes an item.

array
RenameFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Renames (or copies) a file

array
RenameFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Renames (or copies) a folder

array
RenameItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Renames or copies an item

array
MoveFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Moves (or copies) a file

array
MoveFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Moves (or copies) a folder

array
MoveItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Moves or copies an item.

array
LikeFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Likes or dislikes a file

array
LikeFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Likes or dislikes a folder

array|null
LikeItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Likes or dislikes an item

array
TagFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a tag to a file

array
TagFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a tag to a folder

array
TagItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a tag to an item

void
DeleteTag(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes an item tag

array
CommentFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a comment to a file

array
CommentFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a comment to a folder

array
CommentItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a comment to an item

array
EditComment(Input $input, Authenticator|null $authenticator)

Edits an existing comment properties

void
DeleteComment(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes a comment

array
GetFileComments(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns comments on a file

array
GetFolderComments(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns comments on a folder

array
GetItemComments(ItemAccess $access, Input $input)

Returns comments on an item

array
GetFileLikes(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns likes on a file

array
GetFolderLikes(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns likes on a folder

array
GetItemLikes(ItemAccess $access, Input $input)

Returns likes on an item

array
ShareFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates shares for a file

array
ShareFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates shares for a folder

array
ShareItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates shares for an item

array
EditShare(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Edits properties of an existing share

void
DeleteShare(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes an existing share

array
ShareInfo(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Retrieves metadata on a share object (from a link)

array
ListShares(Input $input, Authenticator|null $authenticator)

Returns a list of shares

array
ListAdopted(Input $input, Authenticator|null $authenticator)

Returns a list of all items where the user owns the item but not the parent

array
GetFilesystem(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Returns filesystem metadata (default if none specified)

array
GetFilesystems(Input $input, Authenticator|null $authenticator)

Returns a list of all filesystems available

array
CreateFilesystem(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates a new filesystem

array
EditFilesystem(Input $input, Authenticator|null $authenticator)

Edits an existing filesystem

void
DeleteFilesystem(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Removes a filesystem (and potentially its content)

array
GetLimitObject(Input $input, Authenticator|null $authenticator, bool $allowAuto, bool $allowMany, bool $timed)

Common function for loading and authenticating the limited object and limit class referred to by input

array|null
GetLimits(Input $input, Authenticator|null $authenticator)

Loads the total limit object or objects for the given objects

array
GetTimedLimits(Input $input, Authenticator|null $authenticator)

Loads the timed limit object or objects for the given objects

array|null
GetTimedStatsFor(Input $input, Authenticator|null $authenticator)

Returns all stored time stats for an object

array|null
GetTimedStatsAt(Input $input, Authenticator|null $authenticator)

Returns timed stats for the given object or objects at the given time

array
ConfigLimits(Input $input, Authenticator|null $authenticator)

Configures total limits for the given object

array
ConfigTimedLimits(Input $input, Authenticator|null $authenticator)

Configures timed limits for the given object

void
PurgeLimits(Input $input, Authenticator|null $authenticator)

Deletes all total limits for the given object

void
PurgeTimedLimits(Input $input, Authenticator|null $authenticator)

Deletes all timed limits for the given object

Details

in InstalledApp at line 126
__construct(Main $API)

All apps are constructed when Andromeda runs

Parameters

Main $API

at line 188
mixed Run(Input $input)

Checks if the client is running/needs to run install/upgrade {@inheritDoc}

Parameters

Input $input

the user input

Return Value

mixed

the value to be output to the user

Exceptions

InstallRequiredException

if the DB is not installed

UpgradeRequiredException

if the DB version does not match

See also

\Andromeda\Apps\Files\BaseApp::Run()

at line 112
static array getUsage()

Returns an array of strings showing the CLI usage of the app

Return Value

array

possible commands

at line 104
static string getName()

No description

Return Value

string

the lowercase name of the app

at line 106
static protected string|null getLogClass()

Return this app's BaseAppLog class name, if used (or null)

Return Value

string|null

in BaseApp at line 59
static protected getMetadata(string $app, string $key)

Loads a metadata for the given app with the given key

Loads the app's JSON metadata file but not its code

Parameters

string $app
string $key

in BaseApp at line 77
static array getAppRequires(string $app)

No description

Parameters

string $app

Return Value

array

Returns the list of apps this app depends on

in BaseApp at line 83
static string getAppApiVersion(string $app)

No description

Parameters

string $app

Return Value

string

Returns the major.minor API version this app is compatible with

in BaseApp at line 89
static string getVersion()

No description

Return Value

string

the app's version information

at line 180
commit()

Tells the app to commit any changes made outside the database

at line 181
rollback()

Tells the app to rollback any changes made outside the database

in InstalledApp at line 107
static protected string getInstallFlags()

No description

Return Value

string

in InstalledApp at line 108
static protected string getUpgradeFlags()

No description

Return Value

string

in InstalledApp at line 110
static protected array getInstallUsage()

No description

Return Value

array

at line 108
static protected string getConfigClass()

Return the BaseConfig class for this app

Return Value

string

in InstalledApp at line 144
protected bool allowInstall()

Returns true if the user is allowed to install/upgrade

Return Value

bool

in InstalledApp at line 151
static protected string getTemplateFolder()

Returns the path of the app's code folder

Return Value

string

in InstalledApp at line 157
static protected array getUpgradeScripts()

No description

Return Value

array

the array of upgrade scripts indexed by version (in order!)

in InstalledApp at line 194
protected Install(Input $input)

Installs the app by importing its SQL file and creating config

Parameters

Input $input

in InstalledApp at line 207
protected Upgrade(Input $input)

Iterates over the list of upgrade scripts, running them sequentially until the DB is up to date with the code

Parameters

Input $input

at line 110
protected Config GetConfig()

No description

Return Value

Config

at line 268
private ItemAccess AuthenticateFileAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string|null $id = null)

Returns an ItemAccess authenticating the given file ID (or null to get from input), throws exceptions on failure

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog
string|null $id

Return Value

ItemAccess

at line 275
private ItemAccess AuthenticateFolderAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string|null $id = null, bool $isParent = false)

Returns an ItemAccess authenticating the given folder ID (or null to get from input), throws exceptions on failure

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog
string|null $id
bool $isParent

Return Value

ItemAccess

at line 282
private ItemAccess|null TryAuthenticateFolderAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string|null $id = null, bool $isParent = false)

Returns an ItemAccess authenticating the given folder ID (or null to get from input), returns null on failure

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog
string|null $id
bool $isParent

Return Value

ItemAccess|null

at line 289
static private void UnknownItemException(string|null $class = null)

Throws an unknown file/folder exception if given, else item exception

Parameters

string|null $class

Return Value

void

at line 300
private ItemAccess AuthenticateItemAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string $class, string|null $id, bool $isParent = false)

Returns an ItemAccess authenticating the given item class/ID, throws exceptions on failure

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog
string $class
string|null $id
bool $isParent

Return Value

ItemAccess

at line 319
private ItemAccess|null TryAuthenticateItemAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, string $class, string|null $id, bool $isParent = false)

Returns an ItemAccess authenticating the given item class/ID, returns null on failure

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog
string $class
string|null $id
bool $isParent

Return Value

ItemAccess|null

at line 339
private ItemAccess AuthenticateItemObjAccess(Input $input, Authenticator|null $auth, AccessLog|null $accesslog, Item $item, bool $isParent = false)

Returns an ItemAccess authenticating the given already-loaded object

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog
Item $item
bool $isParent

Return Value

ItemAccess

at line 353
protected array RunGetConfig(Input $input, Authenticator|null $authenticator)

Gets config for this app

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

Config

See also

Config::GetClientObject

at line 366
protected array RunSetConfig(Input $input, Authenticator|null $authenticator)

Sets config for this app

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

Config

Exceptions

AuthenticationFailedException

if not admin

See also

Config::GetClientObject

at line 382
protected array UploadFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Uploads a new file to the given folder. Bandwidth is counted.

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File newly created file

Exceptions

AuthenticationFailedException

if not signed in and public upload not allowed

ItemAccessDeniedException

if accessing via share and share does not allow upload

See also

File::GetClientObject

at line 431
protected void DownloadFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Downloads a file or part of a file

Can accept an input byte range. Also accepts the HTTP_RANGE header.

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

ItemAccessDeniedException

if accessing via share and read is not allowed

InvalidDLRangeException

if the given byte range is invalid

at line 517
protected array WriteToFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Writes new data to an existing file - data is posted as a file

If no offset is given, the default is to append the file (offset = file size) DO NOT use this in a multi-action transaction as the underlying FS cannot fully rollback writes. The FS will restore the original size of the file but writes within the original size are permanent.

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File

Exceptions

AuthenticationFailedException

if public access and public modify is not allowed

RandomWriteDisabledException

if random write is not allowed on the file

ItemAccessDeniedException

if acessing via share and share doesn't allow modify

See also

File::GetClientObject

at line 579
protected array TruncateFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Truncates (resizes a file)

DO NOT use this in a multi-action transaction as the underlying FS cannot fully rollback truncates. The FS will restore the original size of the file but if the file was shrunk, data will be zeroed.

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File

Exceptions

AuthenticationFailedException

if public access and public modify is not allowed

RandomWriteDisabledException

if random writes are not enabled on the file

ItemAccessDeniedException

if access via share and share does not allow modify

See also

File::GetClientObject

at line 605
protected array GetFileMeta(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Returns file metadata

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File

Exceptions

ItemAccessDeniedException

if accessing via share and reading is not allowed

See also

File::GetClientObject

at line 626
protected array GetFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Lists folder metadata and optionally the items in a folder (or filesystem root)

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Folder

Exceptions

ItemAccessDeniedException

if accessing via share and reading is not allowed

AuthenticationFailedException

if public access and no folder ID is given

UnknownFilesystemException

if the given filesystem does not exist

UnknownFolderException

if the given folder does not exist

See also

Folder::GetClientObject

at line 683
protected array GetItemByPath(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Reads an item by a path (rather than by ID) - can specify a root folder or filesystem

NOTE that /. and /.. have no special meaning - no traversal allowed

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File|Folder with {isfile:bool}

Exceptions

ItemAccessDeniedException

if access via share and read is not allowed

AuthenticationFailedException

if public access and no root is given

UnknownFilesystemException

if the given filesystem is not found

UnknownFolderException

if the given folder is not found

UnknownItemException

if the given item path is invalid

See also

File::GetClientObject
Folder::GetClientObject

at line 749
protected array|null EditFileMeta(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Edits file metadata

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog

Return Value

array|null

See also

FilesApp::EditItemMeta

at line 758
protected array|null EditFolderMeta(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Edits folder metadata

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog

Return Value

array|null

See also

FilesApp::EditItemMeta

at line 770
private array EditItemMeta(ItemAccess $access, Input $input)

Edits item metadata

Parameters

ItemAccess $access

access object for item

Input $input

Return Value

array

Item

Exceptions

ItemAccessDeniedException

if accessing via share and can't modify

See also

Item::GetClientObject

at line 786
protected array OwnFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Takes ownership of a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File

See also

File::GetClientObject

at line 809
protected array OwnFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Takes ownership of a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Folder

See also

Folder::GetClientObject

at line 843
protected array CreateFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates a folder in the given parent

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Folder

Exceptions

AuthenticationFailedException

if public access and public upload not allowed

ItemAccessDeniedException

if accessing via share and share upload not allowed

See also

Folder::GetClientObject

at line 871
protected void DeleteFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

See also

FilesApp::DeleteItem

at line 880
protected void DeleteFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

See also

FilesApp::DeleteItem

at line 896
private void DeleteItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes an item.

DO NOT use this in a multi-action transaction as the underlying FS cannot rollback deletes. If you delete an item and then do another action that results in an error, the content will still be deleted on disk though the database objects will remain.

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

AuthenticationFailedException

if public access and public modify is not allowed

ItemAccessDeniedException

if access via share and share modify is not allowed

at line 920
protected array RenameFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Renames (or copies) a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File

See also

FilesApp::RenameItem
File::GetClientObject

at line 931
protected array RenameFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Renames (or copies) a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Folder

See also

FilesApp::RenameItem
Folder::GetClientObject

at line 943
private array RenameItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Renames or copies an item

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Exceptions

ItemAccessDeniedException

if access via share and share upload/modify is not allowed

AuthenticationFailedException

if public access and public upload/modify is not allowed

at line 993
protected array MoveFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Moves (or copies) a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

File

See also

FilesApp::MoveItem
File::GetClientObject

at line 1004
protected array MoveFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Moves (or copies) a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Folder

See also

FilesApp::MoveItem
Folder::GetClientObject

at line 1016
private array MoveItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Moves or copies an item.

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Exceptions

AuthenticationFailedException

if public access and public modify/upload not allowed

ItemAccessDeniedException

if access via share and share modify/upload not allowed

at line 1060
protected array LikeFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Likes or dislikes a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::LikeItem

at line 1069
protected array LikeFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Likes or dislikes a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::LikeItem

at line 1083
private array|null LikeItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Likes or dislikes an item

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array|null

?Like

Exceptions

AuthenticationFailedException

if not signed in

ItemAccessDeniedException

if access via share if social is not allowed

See also

Like::GetClientObject

at line 1105
protected array TagFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a tag to a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::TagItem

at line 1114
protected array TagFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a tag to a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::TagItem

at line 1128
private array TagItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a tag to an item

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Tag

Exceptions

AuthenticationFailedException

if not signed in

ItemAccessDeniedException

if access via share and share modify is not allowed

See also

Tag::GetClientObject

at line 1156
protected void DeleteTag(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes an item tag

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

AuthenticationFailedException

if not signed in

UnknownItemException

if the given tag is not found

ItemAccessDeniedException

if access via share and share modify is not allowed

at line 1180
protected array CommentFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a comment to a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::CommentItem

at line 1189
protected array CommentFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a comment to a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::CommentFolder

at line 1203
private array CommentItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Adds a comment to an item

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Comment

Exceptions

AuthenticationFailedException

if not signed in

ItemAccessDeniedException

if access via share and share social is not allowed

See also

Comment::GetClientObject

at line 1229
protected array EditComment(Input $input, Authenticator|null $authenticator)

Edits an existing comment properties

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

Comment

Exceptions

AuthenticationFailedException

if not signed in

UnknownItemException

if the comment is not found

See also

Comment::GetClientObject

at line 1250
protected void DeleteComment(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes a comment

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

AuthenticationFailedException

if not signed in

UnknownItemException

if the comment is not found

at line 1270
protected array GetFileComments(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns comments on a file

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::GetItemComments

at line 1279
protected array GetFolderComments(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns comments on a folder

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::GetItemComments

at line 1291
private array GetItemComments(ItemAccess $access, Input $input)

Returns comments on an item

Parameters

ItemAccess $access

file or folder access object

Input $input

Return Value

array

Comment

Exceptions

ItemAccessDeniedException

if access via share and can't read

See also

Comment::GetClientObject

at line 1309
protected array GetFileLikes(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns likes on a file

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::GetItemLikes

at line 1318
protected array GetFolderLikes(Input $input, Authenticator|null $auth, AccessLog|null $accesslog)

Returns likes on a folder

Parameters

Input $input
Authenticator|null $auth
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::GetItemLikes

at line 1330
private array GetItemLikes(ItemAccess $access, Input $input)

Returns likes on an item

Parameters

ItemAccess $access

file or folder access object

Input $input

Return Value

array

Like

Exceptions

ItemAccessDeniedException

if access via share and can't read

See also

Like::GetClientObject

at line 1348
protected array ShareFile(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates shares for a file

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::ShareItem

at line 1357
protected array ShareFolder(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates shares for a folder

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

See also

FilesApp::ShareItem

at line 1374
private array ShareItem(string $class, string $key, Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates shares for an item

Parameters

string $class

item class

string $key

input param for a single item

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Share

Exceptions

AuthenticationFailedException

if public access and public modify/upload not allowed

UnknownDestinationException

if the given share target is not found

UnknownItemException

if the given item to share is not found

EmailShareDisabledException

if emailing shares is not enabled

ShareURLGenerateException

if the URL to email could be not determined

See also

Share::GetClientObject

at line 1464
protected array EditShare(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Edits properties of an existing share

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Share

Exceptions

AuthenticationFailedException

if not signed in

UnknownItemException

if the given share is not found

ItemAccessDeniedException

if not allowed

See also

Share::GetClientObject

at line 1487
protected void DeleteShare(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Deletes an existing share

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

AuthenticationFailedException

if not signed in

UnknownItemException

if the given share is not found

ItemAccessDeniedException

if not allowed

at line 1516
protected array ShareInfo(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Retrieves metadata on a share object (from a link)

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

Share

See also

Share::GetClientObject

at line 1533
protected array ListShares(Input $input, Authenticator|null $authenticator)

Returns a list of shares

if $mine, show all shares we created, else show all shares we're the target of

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

[id:Share]

Exceptions

AuthenticationFailedException

if not signed in

See also

Share::GetClientObject

at line 1557
protected array ListAdopted(Input $input, Authenticator|null $authenticator)

Returns a list of all items where the user owns the item but not the parent

These are items that the user uploaded into someone else's folder, but owns

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

{files:[id:File],folders:[id:Folder]}

Exceptions

AuthenticationFailedException

if not signed in

See also

File::GetClientObject
Folder::GetClientObject

at line 1578
protected array GetFilesystem(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Returns filesystem metadata (default if none specified)

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

FSManager

Exceptions

AuthenticationFailedException

if not signed in

UnknownFilesystemException

if no filesystem was specified or is the default

See also

FSManager::GetClientObject

at line 1606
protected array GetFilesystems(Input $input, Authenticator|null $authenticator)

Returns a list of all filesystems available

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

[id:FSManager]

Exceptions

AuthenticationFailedException

if not signed in

See also

FSManager::GetClientObject

at line 1630
protected array CreateFilesystem(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Creates a new filesystem

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

array

FSManager

Exceptions

AuthenticationFailedException

if not signed in

UserStorageDisabledException

if not admin and user storage is not allowed

See also

FSManager::GetClientObject

at line 1654
protected array EditFilesystem(Input $input, Authenticator|null $authenticator)

Edits an existing filesystem

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

FSManager

Exceptions

AuthenticationFailedException

if not signed in

UnknownFilesystemException

if the given filesystem is not found

See also

FSManager::GetClientObject

at line 1675
protected void DeleteFilesystem(Input $input, Authenticator|null $authenticator, AccessLog|null $accesslog)

Removes a filesystem (and potentially its content)

Parameters

Input $input
Authenticator|null $authenticator
AccessLog|null $accesslog

Return Value

void

Exceptions

AuthenticationFailedException

if not signed in

UnknownFilesystemException

if the given filesystem is not found

at line 1709
private array GetLimitObject(Input $input, Authenticator|null $authenticator, bool $allowAuto, bool $allowMany, bool $timed)

Common function for loading and authenticating the limited object and limit class referred to by input

Parameters

Input $input
Authenticator|null $authenticator
bool $allowAuto

if true, return the current account if no object is specified

bool $allowMany

if true, allow selecting all of the given type

bool $timed

if true, return a timed limit class (not total)

Return Value

array

{class:string, obj:object}

Exceptions

UnknownGroupException

if the given group is not found

UnknownAccountException

if the given account is not found

UnknownFilesystemException

if the given filesystem is not found

UnknownObjectException

if nothing valid was specified

at line 1770
protected array|null GetLimits(Input $input, Authenticator|null $authenticator)

Loads the total limit object or objects for the given objects

Defaults to the current account if none specified

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array|null

Limit | [Limit] client object

Exceptions

AuthenticationFailedException

if not signed in

See also

Total::GetClientObject

at line 1802
protected array GetTimedLimits(Input $input, Authenticator|null $authenticator)

Loads the timed limit object or objects for the given objects

Defaults to the current account if none specified

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

[Limit] client objects

Exceptions

AuthenticationFailedException

if not signed in

See also

Timed::GetClientObject

at line 1833
protected array|null GetTimedStatsFor(Input $input, Authenticator|null $authenticator)

Returns all stored time stats for an object

Defaults to the current account if none specified

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array|null

[id:TimedStats]

Exceptions

AuthenticationFailedException

if not signed in

See also

TimedStats::GetClientObject

at line 1860
protected array|null GetTimedStatsAt(Input $input, Authenticator|null $authenticator)

Returns timed stats for the given object or objects at the given time

Defaults to the current account if none specified

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array|null

TimedStats | [id:TimedStats]

Exceptions

AuthenticationFailedException

if not signed in

See also

TimedStats::GetClientObject

at line 1901
protected array ConfigLimits(Input $input, Authenticator|null $authenticator)

Configures total limits for the given object

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

Limits

Exceptions

AuthenticationFailedException

if not admin

See also

Total::GetClientObject

at line 1919
protected array ConfigTimedLimits(Input $input, Authenticator|null $authenticator)

Configures timed limits for the given object

Parameters

Input $input
Authenticator|null $authenticator

Return Value

array

Limits

Exceptions

AuthenticationFailedException

if not admin

See also

Timed::GetClientObject

at line 1935
protected void PurgeLimits(Input $input, Authenticator|null $authenticator)

Deletes all total limits for the given object

Parameters

Input $input
Authenticator|null $authenticator

Return Value

void

Exceptions

AuthenticationFailedException

if not admin

at line 1951
protected void PurgeTimedLimits(Input $input, Authenticator|null $authenticator)

Deletes all timed limits for the given object

Parameters

Input $input
Authenticator|null $authenticator

Return Value

void

Exceptions

AuthenticationFailedException

if not admin