FileManager
MMO\edms · 1 symbol · generated 5 Oct 2026
FileManager
FileManager.php:39The files and their labels: what edms does, whoever asks (its routes, FileController, or the application's code).
- Namespace
MMO\edms- Extends
- aModule
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
LABEL_TAGS
Properties10
access
maxChunkSize
- Type
- int
maxSize
- Type
- int
removedKeys
- Type
- array
repositories
- Type
- array
storage
trashRetention
- Type
- int
uploadFolder
- Type
- string
uploads
uploadTimeout
- Type
- int
Methods69
active($labels)
FileManager.php:531can($client, $action, $file)
FileManager.php:103canLabel($client, $action, $label)
FileManager.php:108canShare($client, $file)
FileManager.php:113| $client | null | iClient | |
| $file | File | |
| returns | bool | true if $client can put $file in labels (Access::canShare) |
check($client, $action, $file)
FileManager.php:148checkAttach($client, $entity)
FileManager.php:143checkFileName($name)
FileManager.php:848checkLabel($client, $action, $label)
FileManager.php:153checkLabelData($data)
FileManager.php:511checkLabelName($name)
FileManager.php:519checkStorage($before)
FileManager.php:918What is wrong with the files: those whose bytes are missing, and the bytes of no file (older than $before)
clients()
FileManager.php:821| returns | null | ClientRepository | the clients of the application, built from its configuration if need be |
collectGarbage($dryRun)
FileManager.php:895collection($class, $repository)
FileManager.php:551| $class | string | |
| $repository | string | |
| returns | Collection | |
| throws | if the repository $repository has no collection of $class |
commit($entity)
FileManager.php:880Save the changes, and make sure $entity was: a commit only says what it did not save
completeUpload($client, $upload)
FileManager.php:619Make 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)
FileManager.php:365$client makes a label named $name under $parent -- or, without a parent, one of its own tags
deleteFile($client, $file)
FileManager.php:780$client deletes $file for good: it has to be in the trash first
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).
detectMime($filename, $name)
FileManager.php:857exportLabel($label, $client)
FileManager.php:462A label, as the routes give it: what the client can do with it included
files($entities)
FileManager.php:872findChild($collection, $parent, $name)
FileManager.php:500findFiles($client, $options)
FileManager.php:682The files $client can see, as a listing asks for them
findOrphans($before)
FileManager.php:931getAccess()
FileManager.php:89| returns | Access |
getChild($collection, $parent, $name, $create, $owner)
FileManager.php:486The label $name under $parent (a root if null): a deleted one is not found, unless it is to be made again
getClientFiles($client)
FileManager.php:668getClientLabel($client, $path, $create)
FileManager.php:264A label of the space of $client: $path under its root (getClientRoot)
| $client | iClient | |
| $path | array | string | |
| $create = false | bool | if true, create the missing labels, without saving them |
| returns | null | Label |
getClientRoot($client, $create)
FileManager.php:246The root of the space of $client ({collection}/{id}, users/2): the client owns it, and every label under it
getClientTagLabel($client, $path, $create)
FileManager.php:275Get the label for a client's tag, or the global tag of that name if there is one
| $client | iClient | |
| $path | string | |
| $create = false | bool | if true, create the missing client labels, without saving them (loopLabelPath) |
| returns | null | Label |
getClientTags($client, $includeGlobals)
FileManager.php:287getFileById($id)
FileManager.php:562getFileClass()
FileManager.php:557| returns | string |
getFileCollection($class, $repository)
FileManager.php:543Get the file collection
| $class = 'MMO\\edms\\entities\\File' | string | the File entity's class |
| $repository = 'main' | string | the name of the repository to use. |
| returns | Collection |
getFilesFor($attachements, $labels, $allowChildLabel)
FileManager.php:650Get all files concerning a list of given attachments and/or labels
getFileSystemLabel($path, $create)
FileManager.php:224Get the label for a given filesystem path: the shared folders
| $path | string | |
| $create = false | bool | if true, create the missing labels, without saving them (loopLabelPath) |
| returns | null | Label |
getLabelAt($path, $create)
FileManager.php:204Get label at a given path
| $path | array | string | a valid json path |
| $create = false | bool | if true, create the missing labels, without saving them (loopLabelPath) |
| returns | null | Label |
getLabelById($id)
FileManager.php:170getLabelCollection($class, $repository)
FileManager.php:165Get the label collection
| $class = 'MMO\\edms\\entities\\Label' | string | the Label entity's class |
| $repository = 'main' | string | the name of the repository to use. |
| returns | Collection |
getLabelFromString($label, $client, $create)
FileManager.php:300getLabelsAt($path, $includeRoot, $recursive)
FileManager.php:211getLabelsFromString($labels, $client, $create)
FileManager.php:325Get a list of labels from strings (getLabelFromString), separated by spaces
getLabelsSchema($labels)
FileManager.php:340| ...$labels | Label | |
| returns | Schema | the custom fields of the files carrying $labels (Label::$properties) |
getLabelTree($client)
FileManager.php:439The 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()
FileManager.php:85| returns | iStorage |
getTagLabel($path, $create)
FileManager.php:238Get the label for a global tag
| $path | string | |
| $create = false | bool | if true, create the missing labels, without saving them (loopLabelPath) |
| returns | null | Label |
getTags()
FileManager.php:282| returns | array | every global tag |
getUploads()
FileManager.php:93| returns | Uploads |
getVisibleLabels($client, $file)
FileManager.php:134isLabelVisible($client, $label)
FileManager.php:121| $client | iClient | |
| $label | Label | |
| returns | bool | true 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:352labelsOf($ids, $client)
FileManager.php:836loopLabelPath($path, $create)
FileManager.php:182Yield labels from a path
| $path | array | string | a valid json path |
| $create = false | bool | if 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(). |
| returns | Generator | ?Label> name => label, null for the first one missing (then it stops) |
migrate($dryRun)
FileManager.php:951migrateScope($scope, $labels, $files)
FileManager.php:1032onCommit($commit)
FileManager.php:1064Note the bytes of the files a commit removes: they are deleted once the commit saved (onCommitted)
onCommitted($commit)
FileManager.php:1073Delete the bytes of the files removed: the repositories saved (theirs are the listeners of order 100000)
onScopes($request)
FileManager.php:1082The scopes of edms, for the screens granting them
| $request | ScopesList | |
| returns | void |
purge($files)
FileManager.php:792Delete 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)
| $files | array | |
| returns | int | how many were deleted: one another entity references stays (Entity::removePermanently) |
restoreFile($client, $file)
FileManager.php:770$client takes $file out of the trash
scopeCollections()
FileManager.php:813The collections of what holds scopes: the clients and their roles (ClientRepository)
| returns | array |
setRepositories($repositories)
FileManager.php:72setStorage($storage)
FileManager.php:81spaceOwner($label, $clients)
FileManager.php:1050| $label | Label | |
| $clients | ClientRepository | |
| returns | null | iClient | the 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
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).
updateLabel($client, $label, $changes)
FileManager.php:395$client changes $label: its name (label), description, color, or the custom fields of its files (properties)
| $client | iClient | |
| $label | Label | |
| $changes | array | |
| returns | Label | saved |
| throws | if $client cannot edit it, or it is a label of the tree itself (isSystemLabel) |
uploadFile($client, $filename, $name, $labels, $data)
FileManager.php:575Make a file of $client from the local file $filename, and save it: the file is moved to the storage.
| $client | iClient | |
| $filename | string | |
| $name = null | null | string | |
| $labels = [] | array | labels, or tokens (getLabelFromString): the missing ones are made |
| $data = [] | array | |
| returns | File | saved |
Inherited members (48)
| Constants | Declared by | Description | |
|---|---|---|---|
ALERT | iLogLevel | Alert: Action must be taken immediately. | |
ALL | iLogLevel | Mask for all | |
ALL_PLUS | iLogLevel | debug everything | |
BACKTRACE | iLogLevel | ||
CRITICAL | iLogLevel | Critical: Critical conditions. | |
DEBUG | iLogLevel | Debug: Detailed debug information. | |
DEEP | iLogLevel | debug everything with arguments | |
EMERGENCY | iLogLevel | Emergency: System is unusable. | |
ERROR | iLogLevel | Error: Runtime errors that do not require immediate action but should typically be logged and monitored. | |
ERROR_PLUS | iLogLevel | Mask for all error | |
FATAL | iLogLevel | Mask for all fatal error | |
INFO | iLogLevel | Info: Interesting events. | |
INFO_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
MEMORY | iLogLevel | include backtrace object | |
NOTICE | iLogLevel | Notice: Normal but significant events. | |
NOTICE_PLUS | iLogLevel | Mask for all errors/warning/notices/info | |
TRACE | iLogLevel | include backtrace as origins | |
WARNING | iLogLevel | Warning: Exceptional occurrences that are not errors. | |
WARNING_PLUS | iLogLevel | Mask for all errors and warnings |
| Properties | Declared by | Description | |
|---|---|---|---|
verbosity | aModule |
| Methods | Declared by | Description | |
|---|---|---|---|
alert($message, $context) | aModule | Action must be taken immediately. | |
backtraces($message, $context) | aModule | Force-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) | aModule | Merge $config into this module's configuration in the shared Configuration. | |
critical($message, $context) | aModule | Critical conditions. No-op if CRITICAL is currently filtered out by the verbosity mask. | |
debug($message, $context) | aModule | Detailed debug information. | |
debugName() | aModule | Human-readable identifier used as the default {origin} in this instance's log messages. | |
DefaultConfig() | aModule | The config a module starts from before anything loaded via Configuration is merged in. | |
emergency($message, $context) | aModule | System is unusable. No-op if EMERGENCY is currently filtered out by the verbosity mask. | |
error($message, $context) | aModule | Runtime errors that do not require immediate action but should typically be logged and monitored. | |
getVerbosity() | aModule | ||
info($message, $context) | aModule | Interesting 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) | aModule | Logs with an arbitrary level. | |
notice($message, $context) | aModule | Normal 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) | aModule | Set the current verbosity mask, replacing whatever it was before. | |
Shared() | aModule | Get the shared instance, creating (and configuring) it on first call. | |
testVerbosity($level) | aModule | Test whether a given level (or set of levels) is currently enabled by this instance's verbosity mask. | |
traitUnshare($serialize) | aModule | Remove 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) | aModule | Like 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) | aModule | Exceptional occurrences that are not errors. | |
__construct($config) | aModule | protected constructor, so it is not possible to do new Module(...) called by the serialization process just before being injected with data. |