FileController
MMO\edms\controllers · 1 symbole · générée le 27 Oct 2026
FileController
FileController.php:46The files over http, for the logged-in user (FileManager does the work, and checks the rights).
- Espace de noms
MMO\edms\controllers- Étend
- 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 | ||
| DirectUploadUrl($labels, $attachment) 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) | ||
| Fingerprint($defs) static | ||
| flag($route, $name) | ||
| Header($request, $name) static | ||
| label($route) | ||
| labels($route, $user) | ||
| MissingFileNames($names, $length) static | The names of the files an archive left out, for <mmo-filemanager> to say which (my.oviepro #302): each one url-encoded (a comma, a letter that is not ascii, a line break are safe in a header), co… | |
| onRoute($route) | ||
| routeAbortUpload($route) | ||
| routeArchive($route) | A file whose bytes are missing from the storage is left out (my.oviepro #292: the whole zip was a 500): the zip then holds a text file naming those left out, and says how many in its `X-Missing-Fil… | |
| 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. | |
| routeUploadFile($route) | Upload a file in one request: a multipart body whose field file is the file -- what a form, or <mmo-editor upload-url>, sends. | |
| SchemaDefs($fields, $labels) static | ||
| SchemasVersion($fields, $labels) static | ||
| SchemaUrl($fields, $labels) static | The url of the files' schemas document (routeSchemas), versioned like mmo.core's data/schemas.json (v=, SchemasVersion): the browser keeps it until the schemas of the files or of thei… | |
| 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 | ||
| uploadTarget($route, $user, $labels, $attachment) | What an upload goes to, checked before its bytes are stored: the record it is attached to (whoever the application lets attach to it: FileManager::checkAttach), then its labels -- $user's own … | |
| UploadUrl() static | ||
| user($route) | ||
| wholeList($route, $files) | The meta of the data api (mmo.core's RepositoryController) for a list sent whole, on one page: its total and its page, which a <mmo-table> or a <mmo-search> counts and pages by (my.oviepro #92) |
Constantes2
CSRF_KEY
LIST_FIELDS
the fields a listing gives of a file (exportFile), for the schema it links to
Propriétés2
privateKey
- Type
- null | iPrivateKey
publicKey
- Type
- null | iPublicKey
Méthodes49
attachments($route)
FileController.php:243BaseUrl()
staticFileController.php:60| retourne | string | the url the api's routes start with (.../edms/) |
body($route)
FileController.php:203checkToken($route)
FileController.php:185Make 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:77DirectUploadUrl($labels, $attachment)
staticFileController.php:667| $labels = '' | string | where the files go (routeUploadFile): label ids, or quoted paths and "#tags" |
| $attachment = null | null | string | the uid of the record they are attached to |
| retourne | string | the url of routeUploadFile, for an <mmo-editor upload-url> (and its upload-token: Token) |
document($route)
FileController.php:196exportFile($file, $user)
FileController.php:260A 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:210Fingerprint($defs)
staticFileController.php:145flag($route, $name)
FileController.php:250Header($request, $name)
staticFileController.php:82| $request | RequestInterface | |
| $name | string | |
| retourne | string | a header of $request (FileResponse::Header) |
label($route)
FileController.php:217labels($route, $user)
FileController.php:228MissingFileNames($names, $length)
staticFileController.php:506The names of the files an archive left out, for <mmo-filemanager> to say which (my.oviepro #302): each one url-encoded (a comma, a letter that is not ascii, a line break are safe in a header), comma separated, as many as fit in $length -- X-Missing-Files says how many there are in all.
onRoute($route)
FileController.php:86routeAbortUpload($route)
FileController.php:748routeArchive($route)
FileController.php:428A file whose bytes are missing from the storage is left out (my.oviepro #292: the whole zip was a 500): the zip then holds a text file naming those left out, and says how many in its X-Missing-Files header, and which in X-Missing-File-Names (MissingFileNames). None left: 404.
| $route | Route | |
| retourne | FileResponse | the files ids (comma separated) the user can see, in a zip |
routeBulk($route)
FileController.php:391Act 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:381| $route | Route | |
| retourne | FileResponse | the bytes of the file {id} |
routeCreateLabel($route)
FileController.php:544Make a label: {label, parent, description, color, properties} -- without a parent, a tag of the user
routeDeleteFile($route)
FileController.php:358routeDeleteLabel($route)
FileController.php:569routeDownload($route)
FileController.php:900| $route | Route | |
| retourne | FileResponse | the file's content (edms 2's url of routeContent) |
routeFile($route)
FileController.php:340routeFiles($route)
FileController.php:312The files the user can see
| $route | Route | |
| retourne | array | mixed>> exportFile |
routeLabels($route)
FileController.php:873The tags of the current user, and the global ones: a tree of {value, label, title, color, path, children}
| $route | Route | |
| retourne | mixed>> |
routeLabelTree($route)
FileController.php:535| $route | Route | |
| retourne | array | mixed>> the labels the user can see, as a tree (FileManager::getLabelTree) |
routeList($route)
FileController.php:836| $route | Route | |
| retourne | mixed>> the files matching the query the current user can see (exportFile) |
routeMyList($route)
FileController.php:812| $route | Route | |
| retourne | mixed>> the current user's files matching the query (exportFile) |
routeRestoreFile($route)
FileController.php:373routeSchemas($route)
FileController.php:785Get the schema associated to a list of labels
routeStartUpload($route)
FileController.php:600Start 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 | |
| retourne | array | mixed> Upload::jsonSerialize, with the size of a chunk (chunkSize) |
routeToken($route)
FileController.php:586The 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:349routeUpdateLabel($route)
FileController.php:560routeUpload($route)
FileController.php:706routeUploadChunk($route)
FileController.php:722Send 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.
routeUploadFile($route)
FileController.php:630Upload a file in one request: a multipart body whose field file is the file -- what a form, or <mmo-editor upload-url>, sends. labels, attachment, name (the file's own name otherwise) and description come in the query or in the form's fields, so that an upload-url can say where its images go. The rights are those of a chunked upload (routeStartUpload), which stays the way for a file php would not take in one request (upload_max_filesize, post_max_size), or one to resume.
| $route | Route | |
| retourne | array | array<string, mixed>, url: string} the file (exportFile), and url the address showing it (inline=1), which an editor puts in its html |
SchemaDefs($fields, $labels)
staticFileController.php:153SchemasVersion($fields, $labels)
staticFileController.php:140| $fields = [] | array | |
| ...$labels | Label | |
| retourne | string | a fingerprint of the schemas document of $fields and $labels (routeSchemas): the hash of its content, which changes with the files' class, the labels' custom fields and the translations |
SchemaUrl($fields, $labels)
staticFileController.php:121The url of the files' schemas document (routeSchemas), versioned like mmo.core's data/schemas.json (v=, SchemasVersion): the browser keeps it until the schemas of the files or of their labels change.
sendFile($route, $inline)
FileController.php:518| $route | Route | |
| $inline | bool | |
| retourne | FileResponse | the file {id}, if the user can see it |
TemporaryFile($id, $user)
staticFileController.php:763The 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 | |
| retourne | null | string | the local file, null if $user has no such complete temporary upload |
Token()
staticFileController.php:55| retourne | string | the CSRF token of the session, for the requests changing something |
uploadTarget($route, $user, $labels, $attachment)
FileController.php:679What an upload goes to, checked before its bytes are stored: the record it is attached to (whoever the application lets attach to it: FileManager::checkAttach), then its labels -- $user's own "#tags" made if missing -- in which $user must be allowed to put files.
UploadUrl()
staticFileController.php:70| retourne | string |
user($route)
FileController.php:174wholeList($route, $files)
FileController.php:860The meta of the data api (mmo.core's RepositoryController) for a list sent whole, on one page: its total and its page, which a <mmo-table> or a <mmo-search> counts and pages by (my.oviepro #92)
Membres hérités (55)
| Constantes | Déclaré par | 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 |
| Propriétés | Déclaré par | Description | |
|---|---|---|---|
verbosity | aModule |
| Méthodes | Déclaré par | 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… |