Index

FileManager

MMO\edms · 1 symbol · generated 5 Oct 2026

class

FileManager

FileManager.php:39

The files and their labels: what edms does, whoever asks (its routes, FileController, or the application's code).

class MMO\edms\FileManager extends MMO\core\classes\aModule
Namespace
MMO\edms
Extends
aModule
The methods taking a client as their first argument act for that client: they check its rights ([`Access`](https://mcp.mmoframework.fr/documentation/mmo.edms/php/helpers/Access.md#access)) and throw [`eForbidden`](https://mcp.mmoframework.fr/documentation/mmo.edms/php/exceptions/eForbidden.md#eforbidden) when it has not. The others (`uploadFile()`, `getTagLabel()`...) are the application's, and check nothing. Configuration: ```json "MMO\\edms\\FileManager": { "repositories": {"main": {"$": "#repository"}}, "storage": {"$": "MMO\\edms\\storages\\LocalStorage", "folder": "{files}"}, "maxSize": 536870912 } ```

Index

LABEL_FILESYSTEM
LABEL_TAGS
access
maxChunkSize
maxSize
removedKeys
repositories
storage
trashRetention
uploadFolder
uploads
uploadTimeout
active($labels)
can($client, $action, $file)
canLabel($client, $action, $label)
canShare($client, $file)
check($client, $action, $file)
checkAttach($client, $entity)
checkFileName($name)
checkLabel($client, $action, $label)
checkLabelData($data)
checkLabelName($name)
checkStorage($before)What is wrong with the files: those whose bytes are missing, and the bytes of no file (older than $before)
clients()
collectGarbage($dryRun)What the garbage collector does, to run every day or so (php cli.php edms gc): - deletes the uploads nothing was received for since $uploadTimeout; - deletes the files in the trash since @se…
collection($class, $repository)
commit($entity)Save the changes, and make sure $entity was: a commit only says what it did not save
completeUpload($client, $upload)Make the file of a complete upload of $client: what it asked for is checked again (the labels may have changed since it started)
createLabel($client, $name, $parent, $data)$client makes a label named $name under $parent -- or, without a parent, one of its own tags
deleteFile($client, $file)$client deletes $file for good: it has to be in the trash first
deleteLabel($client, $label)$client deletes $label: the files carrying it stay, without it.
detectMime($filename, $name)
exportLabel($label, $client)A label, as the routes give it: what the client can do with it included
files($entities)
findChild($collection, $parent, $name)
findFiles($client, $options)The files $client can see, as a listing asks for them
findOrphans($before)
getAccess()
getChild($collection, $parent, $name, $create, $owner)The label $name under $parent (a root if null): a deleted one is not found, unless it is to be made again
getClientFiles($client)
getClientLabel($client, $path, $create)A label of the space of $client: $path under its root (getClientRoot)
getClientRoot($client, $create)The root of the space of $client ({collection}/{id}, users/2): the client owns it, and every label under it
getClientTagLabel($client, $path, $create)Get the label for a client's tag, or the global tag of that name if there is one
getClientTags($client, $includeGlobals)
getFileById($id)
getFileClass()
getFileCollection($class, $repository)Get the file collection
getFilesFor($attachements, $labels, $allowChildLabel)Get all files concerning a list of given attachments and/or labels
getFileSystemLabel($path, $create)Get the label for a given filesystem path: the shared folders
getLabelAt($path, $create)Get label at a given path
getLabelById($id)
getLabelCollection($class, $repository)Get the label collection
getLabelFromString($label, $client, $create)Get one label from a token of the routes: - an id (12); - a quoted path from the root of the tree ("_FILESYSTEM/docs"); - a quoted tag ("#invoices"): the global tag of that name, or the tag o…
getLabelsAt($path, $includeRoot, $recursive)
getLabelsFromString($labels, $client, $create)Get a list of labels from strings (getLabelFromString), separated by spaces
getLabelsSchema($labels)
getLabelTree($client)The labels $client can see, as a tree: its own space, the labels granted to it, and the labels of the files it can see
getStorage()
getTagLabel($path, $create)Get the label for a global tag
getTags()
getUploads()
getVisibleLabels($client, $file)
isLabelVisible($client, $label)
isSystemLabel($label)
labelsOf($ids, $client)
loopLabelPath($path, $create)Yield labels from a path
migrate($dryRun)Bring the data of edms 2 to 3 (php cli.php edms migrate), as many times as needed: - the bytes of a file of edms 2 move from {basepath}/files (2's default folder) to the storage, when they are …
migrateScope($scope, $labels, $files)
onCommit($commit)Note the bytes of the files a commit removes: they are deleted once the commit saved (onCommitted)
onCommitted($commit)Delete the bytes of the files removed: the repositories saved (theirs are the listeners of order 100000)
onScopes($request)The scopes of edms, for the screens granting them
purge($files)Delete files for good: their bytes and their rows.
restoreFile($client, $file)$client takes $file out of the trash
scopeCollections()The collections of what holds scopes: the clients and their roles (ClientRepository)
setRepositories($repositories)
setStorage($storage)
spaceOwner($label, $clients)
trashFile($client, $file)$client puts $file in the trash: it disappears from the listings, and is deleted after $trashRetention
updateFile($client, $file, $changes)$client changes $file: its name (label), description, custom fields (data, checked against what its labels define), or its labels (labels: the ids of all of them, or addLabels/`removeLabe…
updateLabel($client, $label, $changes)$client changes $label: its name (label), description, color, or the custom fields of its files (properties)
uploadFile($client, $filename, $name, $labels, $data)Make a file of $client from the local file $filename, and save it: the file is moved to the storage.

Constants2

LABEL_FILESYSTEM

const LABEL_FILESYSTEM = '_FILESYSTEM'

LABEL_TAGS

const LABEL_TAGS = '_TAGS'

Properties10

access

#[MMO\core\attributes\Serialize(false)] protected ?MMO\edms\helpers\Access $access = null
Type
null | Access

maxChunkSize

int $maxChunkSize = 16777216
Type
int

maxSize

int $maxSize = 536870912
Type
int

removedKeys

#[MMO\core\attributes\Serialize(false)] protected array $removedKeys = []
Type
array

repositories

#[MMO\core\attributes\Serialize(unserialize: 'setRepositories')] protected array $repositories = []
Type
array

storage

#[MMO\core\attributes\Serialize(unserialize: 'setStorage')] protected ?MMO\edms\interfaces\iStorage $storage = null
Type
null | iStorage

trashRetention

int $trashRetention = 2592000
Type
int

uploadFolder

string $uploadFolder = '{files}/.uploads'
Type
string

uploads

#[MMO\core\attributes\Serialize(false)] protected ?MMO\edms\helpers\Uploads $uploads = null
Type
null | Uploads

uploadTimeout

int $uploadTimeout = 86400
Type
int

Methods69

check($client, $action, $file)

FileManager.php:148
function check( ?MMO\oauth\interfaces\iClient $client, string $action, MMO\edms\entities\File $file ): void
$clientnull | iClient
$actionstring
$fileFile
returnsvoid
throwsunless $client can do $action with $file

checkAttach($client, $entity)

FileManager.php:143
function checkAttach( MMO\oauth\interfaces\iClient $client, MMO\core\interfaces\iEntity $entity ): void
$clientiClient
$entityiEntity
returnsvoid
throwsunless the application lets $client attach a file to $entity (Attach: nobody answering lets it)

checkFileName($name)

FileManager.php:848
function checkFileName(string $name): string
$namestring
returnsstring$name, as a file's name -- which holds no path: / and \ are _ @throws eInvalid (400) if it cannot be one

checkLabel($client, $action, $label)

FileManager.php:153
function checkLabel( ?MMO\oauth\interfaces\iClient $client, string $action, MMO\edms\entities\Label $label ): void
$clientnull | iClient
$actionstring
$labelLabel
returnsvoid
throwsunless $client can do $action with $label

checkLabelData($data)

FileManager.php:511
protected function checkLabelData(array $data): void
$dataarray
returnsvoid
throws(400) if the color is not a css color (it is written in the pages' styles), or the properties no object

checkLabelName($name)

FileManager.php:519
protected function checkLabelName(string $name): string
$namestring
returnsstring$name, as a label's name @throws eInvalid (400) if it cannot be one

checkStorage($before)

FileManager.php:918

What is wrong with the files: those whose bytes are missing, and the bytes of no file (older than $before)

function checkStorage(?int $before = null): array
$before = nullnull | int
returnsarraylist<string>, orphans: list<string>} the uids of the files, the storage keys of the bytes

collectGarbage($dryRun)

FileManager.php:895
What the garbage collector does, to run every day or so (`php cli.php edms gc`): - deletes the uploads nothing was received for since [`$uploadTimeout`](https://mcp.mmoframework.fr/documentation/mmo.edms/php/FileManager.md#filemanager-uploadtimeout); - deletes the files in the trash since [`$trashRetention`](https://mcp.mmoframework.fr/documentation/mmo.edms/php/FileManager.md#filemanager-trashretention); - deletes the bytes no file has, kept longer than a day (an upload that failed after they were stored).function collectGarbage(bool $dryRun = false): array
$dryRun = falseboolif true, say what would be done, without doing it
returnsarrayint, trash: int, orphans: list<string>}

collection($class, $repository)

FileManager.php:551
protected function collection(string $class, string $repository): MMO\core\entities\Collection
$classstring
$repositorystring
returnsCollection
throwsif the repository $repository has no collection of $class

commit($entity)

FileManager.php:880

Save the changes, and make sure $entity was: a commit only says what it did not save

protected function commit(MMO\core\interfaces\iEntity $entity): void
$entityiEntity
returnsvoid
throwsif $entity was not saved

completeUpload($client, $upload)

FileManager.php:619

Make the file of a complete upload of $client: what it asked for is checked again (the labels may have changed since it started)

function completeUpload(MMO\oauth\interfaces\iClient $client, MMO\edms\helpers\Upload $upload): MMO\edms\entities\File
$clientiClient
$uploadUpload
returnsFilesaved
throwsif $client can no longer put the file in one of its labels

createLabel($client, $name, $parent, $data)

FileManager.php:365

$client makes a label named $name under $parent -- or, without a parent, one of its own tags

function createLabel( MMO\oauth\interfaces\iClient $client, string $name, ?MMO\edms\entities\Label $parent = null, array $data = [] ): MMO\edms\entities\Label
$clientiClient
$namestring
$parent = nullnull | Label
$data = []array
returnsLabelsaved
throwsif $client cannot make labels under $parent (Access::CREATE)
throws(400) if $name is not a valid name, (409) if $parent has a label of that name already

deleteFile($client, $file)

FileManager.php:780

$client deletes $file for good: it has to be in the trash first

function deleteFile(MMO\oauth\interfaces\iClient $client, MMO\edms\entities\File $file): void
$clientiClient
$fileFile
returnsvoid
throws(409) if it is not

deleteLabel($client, $label)

FileManager.php:423

$client deletes $label: the files carrying it stay, without it. The label is only archived, so its id -- and the scopes naming it -- is never another label's (a label made again at the same place gets it back).

function deleteLabel(MMO\oauth\interfaces\iClient $client, MMO\edms\entities\Label $label): void
$clientiClient
$labelLabel
returnsvoid
throwsif $client cannot delete it, or it is a label of the tree itself
throws(409) if it has labels under it

detectMime($filename, $name)

FileManager.php:857
protected function detectMime(string $filename, string $name): string
$filenamestring
$namestring
returnsstringthe media type of the bytes of $filename (the name decides only what the bytes do not)

exportLabel($label, $client)

FileManager.php:462

A label, as the routes give it: what the client can do with it included

function exportLabel(MMO\edms\entities\Label $label, MMO\oauth\interfaces\iClient $client): array
$labelLabel
$clientiClient
returnsarraymixed>

findChild($collection, $parent, $name)

FileManager.php:500
protected function findChild( MMO\core\entities\Collection $collection, ?MMO\edms\entities\Label $parent, string $name ): ?MMO\edms\entities\Label
$collectionCollection
$parentnull | Label
$namestring
returnsnull | Labelthe label $name under $parent, deleted or not

findFiles($client, $options)

FileManager.php:682

The files $client can see, as a listing asks for them

function findFiles(MMO\oauth\interfaces\iClient $client, array $options = []): array
$clientiClient
$options = []array
returnsarraylist<File>, total: int}

findOrphans($before)

FileManager.php:931
protected function findOrphans(int $before): array
$beforeintonly the bytes written before then: an upload being saved has bytes and no file yet
returnsarraythe storage keys no file has

getChild($collection, $parent, $name, $create, $owner)

FileManager.php:486

The label $name under $parent (a root if null): a deleted one is not found, unless it is to be made again

protected function getChild( MMO\core\entities\Collection $collection, ?MMO\edms\entities\Label $parent, string $name, bool $create, ?MMO\oauth\interfaces\iClient $owner = null ): ?MMO\edms\entities\Label
$collectionCollection
$parentnull | Label
$namestring
$createbool
$owner = nullnull | iClientthe owner of a new label: its parent's if null
returnsnull | Label

getClientFiles($client)

FileManager.php:668
function getClientFiles(MMO\oauth\interfaces\iClient $client): array
$clientiClient
returnsarrayevery file of $client

getClientLabel($client, $path, $create)

FileManager.php:264

A label of the space of $client: $path under its root (getClientRoot)

function getClientLabel( MMO\oauth\interfaces\iClient $client, array|string $path, bool $create = false ): ?MMO\edms\entities\Label
$clientiClient
$patharray | string
$create = falseboolif true, create the missing labels, without saving them
returnsnull | Label
$manager->getClientLabel($user, '_TAGS/invoices', true); // users/2/_TAGS/invoices for user #2

getClientRoot($client, $create)

FileManager.php:246

The root of the space of $client ({collection}/{id}, users/2): the client owns it, and every label under it

function getClientRoot(MMO\oauth\interfaces\iClient $client, bool $create = false): ?MMO\edms\entities\Label
$clientiClient
$create = falseboolif true, create it if it is missing, without saving it
returnsnull | Label

getClientTagLabel($client, $path, $create)

FileManager.php:275

Get the label for a client's tag, or the global tag of that name if there is one

function getClientTagLabel(MMO\oauth\interfaces\iClient $client, string $path, bool $create = false): ?MMO\edms\entities\Label
$clientiClient
$pathstring
$create = falseboolif true, create the missing client labels, without saving them (loopLabelPath)
returnsnull | Label
$label = $manager->getClientTagLabel($user, 'invoices', true); // "users/2/_TAGS/invoices" for user #2

getClientTags($client, $includeGlobals)

FileManager.php:287
function getClientTags(MMO\oauth\interfaces\iClient $client, bool $includeGlobals = true): array
$clientiClient
$includeGlobals = truebool
returnsarraythe tags of $client, and the global ones if $includeGlobals

getFileCollection($class, $repository)

FileManager.php:543

Get the file collection

function getFileCollection(string $class = 'MMO\\edms\\entities\\File', string $repository = 'main'): MMO\core\entities\Collection
$class = 'MMO\\edms\\entities\\File'stringthe File entity's class
$repository = 'main'stringthe name of the repository to use.
returnsCollection

getFilesFor($attachements, $labels, $allowChildLabel)

FileManager.php:650

Get all files concerning a list of given attachments and/or labels

function getFilesFor( MMO\core\interfaces\iEntity|array|null $attachements = [], array $labels = [], bool $allowChildLabel = true ): array
$attachements = []iEntity | array | nulla list of entities
$labels = []arraya list of labels: a file carries each of them (or, if $allowChildLabel, one of its children)
$allowChildLabel = truebooltrue if children label can be included
returnsarray

getFileSystemLabel($path, $create)

FileManager.php:224

Get the label for a given filesystem path: the shared folders

function getFileSystemLabel(string $path, bool $create = false): ?MMO\edms\entities\Label
$pathstring
$create = falseboolif true, create the missing labels, without saving them (loopLabelPath)
returnsnull | Label

getLabelAt($path, $create)

FileManager.php:204

Get label at a given path

function getLabelAt(array|string $path, bool $create = false): ?MMO\edms\entities\Label
$patharray | stringa valid json path
$create = falseboolif true, create the missing labels, without saving them (loopLabelPath)
returnsnull | Label
$label = $manager->getLabelAt('_FILESYSTEM/docs/2025', true); if ($label->isCreated()) {\MMO\commit($this);} //saves it, with the parents created along

getLabelById($id)

FileManager.php:170
function getLabelById(mixed $id): ?MMO\edms\entities\Label
$idmixed
returnsnull | Labelthe label $id, null if there is none (or it was deleted)

getLabelCollection($class, $repository)

FileManager.php:165

Get the label collection

function getLabelCollection( string $class = 'MMO\\edms\\entities\\Label', string $repository = 'main' ): MMO\core\entities\Collection
$class = 'MMO\\edms\\entities\\Label'stringthe Label entity's class
$repository = 'main'stringthe name of the repository to use.
returnsCollection

getLabelFromString($label, $client, $create)

FileManager.php:300
Get one label from a token of the routes: - an id (`12`); - a quoted path from the root of the tree (`"_FILESYSTEM/docs"`); - a quoted tag (`"#invoices"`): the global tag of that name, or the tag of $client.function getLabelFromString( string $label, ?MMO\oauth\interfaces\iClient $client = null, bool $create = false ): ?MMO\edms\entities\Label
$labelstring
$client = nullnull | iClient
$create = falseboolif true, create the missing labels, without saving them (loopLabelPath)
returnsnull | Label

getLabelsAt($path, $includeRoot, $recursive)

FileManager.php:211
function getLabelsAt(array|string $path, bool $includeRoot = false, bool $recursive = true): array
$patharray | string
$includeRoot = falsebool
$recursive = truebool
returnsarraythe labels under $path (and the one at $path itself if $includeRoot)

getLabelsFromString($labels, $client, $create)

FileManager.php:325

Get a list of labels from strings (getLabelFromString), separated by spaces

function getLabelsFromString( array|string $labels, ?MMO\oauth\interfaces\iClient $client = null, bool $create = false ): array
$labelsarray | string
$client = nullnull | iClient
$create = falseboolif true, create the missing labels, without saving them (loopLabelPath)
returnsarray
throws(404) if one of them does not exist

getLabelTree($client)

FileManager.php:439

The labels $client can see, as a tree: its own space, the labels granted to it, and the labels of the files it can see

function getLabelTree(MMO\oauth\interfaces\iClient $client): array
$clientiClient
returnsarraymixed>> {id, label, path, color, description, properties, owner, system, rights, children}

getTagLabel($path, $create)

FileManager.php:238

Get the label for a global tag

function getTagLabel(string $path, bool $create = false): ?MMO\edms\entities\Label
$pathstring
$create = falseboolif true, create the missing labels, without saving them (loopLabelPath)
returnsnull | Label
$label = $manager->getTagLabel('mytag1', true); if ($label->isCreated()) { $user->allow($label); \MMO\commit($this); //saves the tag and the user's new scope }

getVisibleLabels($client, $file)

FileManager.php:134
function getVisibleLabels(MMO\oauth\interfaces\iClient $client, MMO\edms\entities\File $file): array
$clientiClient
$fileFile
returnsarraythe labels of $file $client may know: all of them for its owner, those it can see for another (a private tag on a file shared says nothing to whom it is shared with)

isLabelVisible($client, $label)

FileManager.php:121
function isLabelVisible(MMO\oauth\interfaces\iClient $client, MMO\edms\entities\Label $label): bool
$clientiClient
$labelLabel
returnsbooltrue if $client may know $label: one it has a right on -- to see its files, or only to drop files in it (Access::CREATE) --, or a global tag: the tags of everyone, which every client uses (_TAGS/...)

isSystemLabel($label)

FileManager.php:352
function isSystemLabel(MMO\edms\entities\Label $label): bool
$labelLabel
returnsbooltrue if $label is part of the tree itself -- a root (_TAGS, _FILESYSTEM, users), the root of a client's space (users/2), or its _TAGS -- which no one renames nor deletes

labelsOf($ids, $client)

FileManager.php:836
protected function labelsOf(array $ids, ?MMO\oauth\interfaces\iClient $client = null): array
$idsarraylabel ids
$client = nullnull | iClientif given, a label it may not know is not found either
returnsarray
throws(404) if one does not exist

loopLabelPath($path, $create)

FileManager.php:182

Yield labels from a path

function loopLabelPath(array|string $path, bool $create = false): Generator
$patharray | stringa valid json path
$create = falseboolif true, create the missing labels, in the space of their parent (Label::$owner). They are not saved: each one is isCreated() until the caller's \MMO\commit().
returnsGenerator?Label> name => label, null for the first one missing (then it stops)

migrate($dryRun)

FileManager.php:951
Bring the data of edms 2 to 3 (`php cli.php edms migrate`), as many times as needed: - the bytes of a file of edms 2 move from `{basepath}/files` (2's default folder) to the storage, when they are not there already, and every file gets its media type and SHA-256; - the labels of a client's space get their owner (`users/2/...`), a tag named `#x` (2.0) is named `x`; - the scopes of 2 (`labels._TAGS.x`, `data.main.files.12`) become those of 3 (`edms.labels.{id}`, `edms.files.12`).function migrate(bool $dryRun = false): array
$dryRun = falseboolif true, say what would be done, without doing it
returnsarraywhat was done

migrateScope($scope, $labels, $files)

FileManager.php:1032
protected function migrateScope(string $scope, array $labels, ?string $files): ?string
$scopestring
$labelsarray
$filesnull | stringthe start of the scopes of edms 2 of the files (data.main.files.json.), null if unknown
returnsnull | stringthe scope of edms 3 for $scope, null if it is not one of edms 2 (or names nothing any more)

onCommit($commit)

FileManager.php:1064

Note the bytes of the files a commit removes: they are deleted once the commit saved (onCommitted)

#[MMO\core\attributes\Listen('MMO\\core\\events\\Commit', order: 1000)] function onCommit(MMO\core\events\Commit $commit): void
$commitCommit
returnsvoid

onCommitted($commit)

FileManager.php:1073

Delete the bytes of the files removed: the repositories saved (theirs are the listeners of order 100000)

#[MMO\core\attributes\Listen('MMO\\core\\events\\Commit', order: 200000)] function onCommitted(MMO\core\events\Commit $commit): void
$commitCommit
returnsvoid

onScopes($request)

FileManager.php:1082

The scopes of edms, for the screens granting them

#[MMO\core\attributes\Listen('MMO\\oauth\\events\\ScopesList')] function onScopes(MMO\oauth\events\ScopesList $request): void
$requestScopesList
returnsvoid

purge($files)

FileManager.php:792

Delete files for good: their bytes and their rows. The scopes naming them name no other file (File::scopeID: the id of a file deleted can be a new file's, its creation time is not)

function purge(array $files): int
$filesarray
returnsinthow many were deleted: one another entity references stays (Entity::removePermanently)

restoreFile($client, $file)

FileManager.php:770

$client takes $file out of the trash

function restoreFile(MMO\oauth\interfaces\iClient $client, MMO\edms\entities\File $file): MMO\edms\entities\File
$clientiClient
$fileFile
returnsFile

spaceOwner($label, $clients)

FileManager.php:1050
protected function spaceOwner(MMO\edms\entities\Label $label, MMO\oauth\ClientRepository $clients): ?MMO\oauth\interfaces\iClient
$labelLabel
$clientsClientRepository
returnsnull | iClientthe client whose space $label is in, for a label of edms 2 (users/2/...)

trashFile($client, $file)

FileManager.php:763

$client puts $file in the trash: it disappears from the listings, and is deleted after $trashRetention

function trashFile(MMO\oauth\interfaces\iClient $client, MMO\edms\entities\File $file): MMO\edms\entities\File
$clientiClient
$fileFile
returnsFile

updateFile($client, $file, $changes)

FileManager.php:718

$client changes $file: its name (label), description, custom fields (data, checked against what its labels define), or its labels (labels: the ids of all of them, or addLabels/removeLabels).

function updateFile( MMO\oauth\interfaces\iClient $client, MMO\edms\entities\File $file, array $changes ): MMO\edms\entities\FilePutting it in labels is sharing it: its owner does ([`canShare`](https://mcp.mmoframework.fr/documentation/mmo.edms/php/FileManager.md#filemanager-canshare)); another who can edit it only takes it out of those it can see. A client that does not see all its labels keeps what it cannot see: the labels, and their custom fields.
$clientiClient
$fileFile
$changesarray
returnsFilesaved
throwsif $client cannot edit the file, or put it in one of the labels added

updateLabel($client, $label, $changes)

FileManager.php:395

$client changes $label: its name (label), description, color, or the custom fields of its files (properties)

function updateLabel( MMO\oauth\interfaces\iClient $client, MMO\edms\entities\Label $label, array $changes ): MMO\edms\entities\Label
$clientiClient
$labelLabel
$changesarray
returnsLabelsaved
throwsif $client cannot edit it, or it is a label of the tree itself (isSystemLabel)

uploadFile($client, $filename, $name, $labels, $data)

FileManager.php:575

Make a file of $client from the local file $filename, and save it: the file is moved to the storage.

function uploadFile( MMO\oauth\interfaces\iClient $client, string $filename, ?string $name = null, array $labels = [], array $data = [] ): MMO\edms\entities\FileThe labels are not checked: to act for a client, an application checks them first (as `completeUpload()` does).
$clientiClient
$filenamestring
$name = nullnull | string
$labels = []arraylabels, or tokens (getLabelFromString): the missing ones are made
$data = []array
returnsFilesaved
$file = $manager->uploadFile($user, '/tmp/scan.pdf', 'Invoice 2026-09.pdf', ['"#invoices"']);
Inherited members (48)
ConstantsDeclared byDescription
ALERTiLogLevelAlert: Action must be taken immediately.
ALLiLogLevelMask for all
ALL_PLUSiLogLeveldebug everything
BACKTRACEiLogLevel
CRITICALiLogLevelCritical: Critical conditions.
DEBUGiLogLevelDebug: Detailed debug information.
DEEPiLogLeveldebug everything with arguments
EMERGENCYiLogLevelEmergency: System is unusable.
ERRORiLogLevelError: Runtime errors that do not require immediate action but should typically be logged and monitored.
ERROR_PLUSiLogLevelMask for all error
FATALiLogLevelMask for all fatal error
INFOiLogLevelInfo: Interesting events.
INFO_PLUSiLogLevelMask for all errors/warning/notices/info
MEMORYiLogLevelinclude backtrace object
NOTICEiLogLevelNotice: Normal but significant events.
NOTICE_PLUSiLogLevelMask for all errors/warning/notices/info
TRACEiLogLevelinclude backtrace as origins
WARNINGiLogLevelWarning: Exceptional occurrences that are not errors.
WARNING_PLUSiLogLevelMask for all errors and warnings
PropertiesDeclared byDescription
verbosityaModule
MethodsDeclared byDescription
alert($message, $context)aModuleAction must be taken immediately.
backtraces($message, $context)aModuleForce-log a message at INFO level together with a full stack trace/memory snapshot (iLogLevel::BACKTRACE), bypassing the verbosity mask entirely (any non-zero verbosity is enough to trigger it).
Configure($config)aModuleMerge $config into this module's configuration in the shared Configuration.
critical($message, $context)aModuleCritical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask.
debug($message, $context)aModuleDetailed debug information.
debugName()aModuleHuman-readable identifier used as the default {origin} in this instance's log messages.
DefaultConfig()aModuleThe config a module starts from before anything loaded via Configuration is merged in.
emergency($message, $context)aModuleSystem is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask.
error($message, $context)aModuleRuntime errors that do not require immediate action but should typically be logged and monitored.
getVerbosity()aModule
info($message, $context)aModuleInteresting events. No-op if INFO is currently filtered out by the verbosity mask.
Instantiate($config)aModule(Re)create the shared instance immediately, configured with $config merged into the class's existing config.
IsShared()aModule
log($level, $message, $context)aModuleLogs with an arbitrary level.
notice($message, $context)aModuleNormal but significant events.
offsetExists($key)aModule\ArrayAccess::offsetExists -- tells whether $key is a declared property at all, regardless of whether it is currently readable/writable through array access.
offsetGet($key)aModule\ArrayAccess::offsetGet -- reads a property directly, unless it has a #[Serialize(serialize: 'methodName')] attribute, in which case that zero-argument method is called instead (e.g.
offsetSet($key, $value)aModule\ArrayAccess::offsetSet -- sets a property directly, unless it has a #[Serialize(unserialize: 'methodName')] attribute, in which case that method is called with $value instead (e.g.
offsetUnset($key)aModule\ArrayAccess::offsetUnset -- equivalent to $module[$key] = null.
serialize($path, $serializer)aModule\MMO\core\interfaces\iSerializable::serialize -- exports every property (via
setVerbosity($verb)aModuleSet the current verbosity mask, replacing whatever it was before.
Shared()aModuleGet the shared instance, creating (and configuring) it on first call.
testVerbosity($level)aModuleTest whether a given level (or set of levels) is currently enabled by this instance's verbosity mask.
traitUnshare($serialize)aModuleRemove the shared instance, so the next Shared() call creates a fresh one.
unserialize($data, $path, $instances)aModule\MMO\core\interfaces\iSerializable::unserialize -- merges $data onto DefaultConfig, runs it through the (possibly overridden) constructor, then applies each resulting value to its property (via
Unshare($serialize)aModuleLike tSingleton::Unshare, but also disconnects this module's instance from every event it was listening to (via Event::DisconnectListeners) before dropping it.
warning($message, $context)aModuleExceptional occurrences that are not errors.
__construct($config)aModuleprotected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data.