FileController
MMO\edms\controllers · 1 symbol · generated 5 Oct 2026
FileController
FileController.php:44The files over http, for the logged-in user (FileManager does the work, and checks the rights).
- Namespace
MMO\edms\controllers- Extends
- aController
Index
| CSRF_KEY | ||
| LIST_FIELDS | the fields a listing gives of a file (exportFile), for the schema it links to | |
| privateKey | ||
| publicKey | ||
| attachments($route) | ||
| BaseUrl() static | ||
| body($route) | ||
| checkToken($route) | Make sure a request changing something comes from a page of the site: it has the session's token, or is authenticated by an Authorization header (which a browser does not send on its own) | |
| ContentDisposition($name, $inline) static | ||
| document($route) | ||
| exportFile($file, $user) | A file as the routes give it to $user: what the page needs, nothing about the server (where the bytes are) nor about the owner (their title only), nor about the labels $user may not know -- a priva… | |
| file($route) | ||
| flag($route, $name) | ||
| Header($request, $name) static | ||
| label($route) | ||
| labels($route, $user) | ||
| onRoute($route) | ||
| routeAbortUpload($route) | ||
| routeArchive($route) | ||
| routeBulk($route) | Act on several files: {action, ids, labels} -- trash, restore, delete (from the trash), label or unlabel (labels: label ids). | |
| routeContent($route) | ||
| routeCreateLabel($route) | Make a label: {label, parent, description, color, properties} -- without a parent, a tag of the user | |
| routeDeleteFile($route) | ||
| routeDeleteLabel($route) | ||
| routeDownload($route) | ||
| routeFile($route) | ||
| routeFiles($route) | The files the user can see | |
| routeLabels($route) | The tags of the current user, and the global ones: a tree of {value, label, title, color, path, children} | |
| routeLabelTree($route) | ||
| routeList($route) | ||
| routeMyList($route) | ||
| routeRestoreFile($route) | ||
| routeSchemas($route) | Get the schema associated to a list of labels | |
| routeStartUpload($route) | Start an upload: {name, size, labels, attachment, temporary} (labels: label ids, or quoted paths and "#tags", the user's own tags made if missing). | |
| routeToken($route) | The session's CSRF token (Token): a page holds the one of the session it was made in, which the server no longer has once the session changed (a new login, a page the browser restored), and `M… | |
| routeUpdateFile($route) | ||
| routeUpdateLabel($route) | ||
| routeUpload($route) | ||
| routeUploadChunk($route) | Send a chunk of the upload {id}: the body is its bytes, the header Content-Range: bytes {first}-{last}/{size} (or the query's offset) says where they go. | |
| SchemaUrl($fields, $labels) static | ||
| sendFile($route, $inline) | ||
| TemporaryFile($id, $user) static | The file a temporary upload (temporary) of $user brought: the page sends its id back to the application, which takes the file -- to move or to delete, it is the caller's. | |
| Token() static | ||
| UploadUrl() static | ||
| user($route) |
Constants2
CSRF_KEY
LIST_FIELDS
the fields a listing gives of a file (exportFile), for the schema it links to
Properties2
privateKey
- Type
- null | iPrivateKey
publicKey
- Type
- null | iPublicKey
Methods41
attachments($route)
FileController.php:193BaseUrl()
staticFileController.php:58| returns | string | the url the api's routes start with (.../edms/) |
body($route)
FileController.php:153checkToken($route)
FileController.php:135Make sure a request changing something comes from a page of the site: it has the session's token, or is authenticated by an Authorization header (which a browser does not send on its own)
ContentDisposition($name, $inline)
staticFileController.php:75document($route)
FileController.php:146exportFile($file, $user)
FileController.php:210A file as the routes give it to $user: what the page needs, nothing about the server (where the bytes are) nor about the owner (their title only), nor about the labels $user may not know -- a private tag of the owner, and the custom fields it defines. The custom fields (data) are columns too, but never replace one of the file's own.
file($route)
FileController.php:160flag($route, $name)
FileController.php:200Header($request, $name)
staticFileController.php:80| $request | RequestInterface | |
| $name | string | |
| returns | string | a header of $request (FileResponse::Header) |
label($route)
FileController.php:167labels($route, $user)
FileController.php:178onRoute($route)
FileController.php:84routeAbortUpload($route)
FileController.php:585routeArchive($route)
FileController.php:372| $route | Route | |
| returns | FileResponse | the files ids (comma separated) the user can see, in a zip |
routeBulk($route)
FileController.php:341Act on several files: {action, ids, labels} -- trash, restore, delete (from the trash), label or unlabel (labels: label ids). A file the user cannot act on is reported, the others are done.
routeContent($route)
FileController.php:331| $route | Route | |
| returns | FileResponse | the bytes of the file {id} |
routeCreateLabel($route)
FileController.php:450Make a label: {label, parent, description, color, properties} -- without a parent, a tag of the user
routeDeleteFile($route)
FileController.php:308routeDeleteLabel($route)
FileController.php:475routeDownload($route)
FileController.php:723| $route | Route | |
| returns | FileResponse | the file's content (edms 2's url of routeContent) |
routeFile($route)
FileController.php:290routeFiles($route)
FileController.php:262The files the user can see
| $route | Route | |
| returns | array | mixed>> exportFile |
routeLabels($route)
FileController.php:696The tags of the current user, and the global ones: a tree of {value, label, title, color, path, children}
| $route | Route | |
| returns | mixed>> |
routeLabelTree($route)
FileController.php:441| $route | Route | |
| returns | array | mixed>> the labels the user can see, as a tree (FileManager::getLabelTree) |
routeList($route)
FileController.php:673| $route | Route | |
| returns | mixed>> the files matching the query the current user can see (exportFile) |
routeMyList($route)
FileController.php:649| $route | Route | |
| returns | mixed>> the current user's files matching the query (exportFile) |
routeRestoreFile($route)
FileController.php:323routeSchemas($route)
FileController.php:622Get the schema associated to a list of labels
routeStartUpload($route)
FileController.php:506Start an upload: {name, size, labels, attachment, temporary} (labels: label ids, or quoted paths and "#tags", the user's own tags made if missing). The answer's id names it for the next requests.
| $route | Route | |
| returns | array | mixed> Upload::jsonSerialize, with the size of a chunk (chunkSize) |
routeToken($route)
FileController.php:492The session's CSRF token (Token): a page holds the one of the session it was made in, which the server no longer has once the session changed (a new login, a page the browser restored), and MMO.edms.Api asks for it again when a request is refused for it. A GET is no risk: another site cannot read the answer (no CORS)
routeUpdateFile($route)
FileController.php:299routeUpdateLabel($route)
FileController.php:466routeUpload($route)
FileController.php:543routeUploadChunk($route)
FileController.php:559Send a chunk of the upload {id}: the body is its bytes, the header Content-Range: bytes {first}-{last}/{size} (or the query's offset) says where they go. The last chunk makes the file (file in the answer), unless the upload is temporary.
SchemaUrl($fields, $labels)
staticFileController.php:112sendFile($route, $inline)
FileController.php:424| $route | Route | |
| $inline | bool | |
| returns | FileResponse | the file {id}, if the user can see it |
TemporaryFile($id, $user)
staticFileController.php:600The file a temporary upload (temporary) of $user brought: the page sends its id back to the application, which takes the file -- to move or to delete, it is the caller's.
| $id | string | |
| $user | iClient | |
| returns | null | string | the local file, null if $user has no such complete temporary upload |
Token()
staticFileController.php:53| returns | string | the CSRF token of the session, for the requests changing something |
UploadUrl()
staticFileController.php:68| returns | string |
user($route)
FileController.php:124Inherited members (55)
| 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. | |
ExtractRoutes($config) | aController | Extract all the APIRoute from this class, regardless of the fact they are registered in the application | |
getVerbosity() | aModule | ||
HasRoutes() | aController | Tells if any APIRoute are registered in the application | |
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 | ||
Link($method, $data) | aController | Build a Link (URL + label/icon/description/title, taken from the route's APIRoute metadata) for a registered route. | |
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. | |
Route($method) | aController | Get a registered APIRoute WARNING: if this class was not registered in the application, it will return null. | |
Routes() | aController | Get a list of registered APIRoutes (from this class) in the application WARNING: if this class was not registered in the application, it will return an empty array. | |
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. | |
Url($method, $data) | aController | Build the URL for a registered route, filling in any {placeholder} from $data. | |
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. | |
__wakeup() | aController | Called automatically right after the controller's shared instance is built (aModule::unserialize): registers onRoute as a Route listener with a low priority (-10), so it… |