IFilesMetadataManager
in
Manager for FilesMetadata; manage files' metadata.
Tags
Table of Contents
Constants
- PROCESS_BACKGROUND = 2
- PROCESS_LIVE = 1
- PROCESS_NAMED = 4
Methods
- deleteMetadata() : void
- delete metadata and its indexes
- getKnownMetadata() : IFilesMetadata
- returns all type of metadata currently available.
- getMetadata() : IFilesMetadata
- returns metadata of a file id
- getMetadataForFiles() : array<string|int, mixed>
- returns metadata of multiple file ids
- getMetadataQuery() : IMetadataQuery
- generate and return a MetadataQuery to help building sql queries
- initMetadata() : void
- Initiate a metadata key with its type.
- refreshMetadata() : IFilesMetadata
- initiate the process of refreshing the metadata in relation to a node usually, this process: - get current metadata from database, if available, or create a new one - dispatch a MetadataLiveEvent, - save new metadata in database, if metadata have been changed during the event - refresh metadata indexes if needed, - prep a new cronjob if an app request it during the event,
- saveMetadata() : void
- save metadata to database and refresh indexes.
Constants
PROCESS_BACKGROUND
public
mixed
PROCESS_BACKGROUND
= 2
Tags
PROCESS_LIVE
public
mixed
PROCESS_LIVE
= 1
Tags
PROCESS_NAMED
public
mixed
PROCESS_NAMED
= 4
Tags
Methods
deleteMetadata()
delete metadata and its indexes
public
deleteMetadata(int $fileId) : void
Parameters
- $fileId : int
-
file id
Tags
getKnownMetadata()
returns all type of metadata currently available.
public
getKnownMetadata() : IFilesMetadata
The list is stored in a IFilesMetadata with null values but correct type.
Note: this method loads lazy appconfig values.
Tags
Return values
IFilesMetadatagetMetadata()
returns metadata of a file id
public
getMetadata(int $fileId[, bool $generate = false ]) : IFilesMetadata
Parameters
- $fileId : int
-
file id
- $generate : bool = false
-
Generate if metadata does not exist
Tags
Return values
IFilesMetadatagetMetadataForFiles()
returns metadata of multiple file ids
public
getMetadataForFiles(array<string|int, int> $fileIds) : array<string|int, mixed>
Parameters
- $fileIds : array<string|int, int>
-
file ids
Tags
Return values
array<string|int, mixed> —File ID is the array key, files without metadata are not returned in the array
getMetadataQuery()
generate and return a MetadataQuery to help building sql queries
public
getMetadataQuery(IQueryBuilder $qb, string $fileTableAlias, string $fileIdField) : IMetadataQuery
Parameters
- $qb : IQueryBuilder
- $fileTableAlias : string
-
alias of the table that contains data about files
- $fileIdField : string
-
alias of the field that contains file ids
Tags
Return values
IMetadataQueryinitMetadata()
Initiate a metadata key with its type.
public
initMetadata(string $key, string $type, bool $indexed, int $editPermission) : void
The call is mandatory before using the metadata property in a webdav request. The call should be part of a migration/repair step and not be called on app's boot process as it is using lazy-appconfig value
Note: this method loads lazy appconfig values.
Parameters
- $key : string
-
metadata key
- $type : string
-
metadata type
- $indexed : bool
-
TRUE if metadata can be search
- $editPermission : int
-
remote edit permission via Webdav PROPPATCH
Tags
refreshMetadata()
initiate the process of refreshing the metadata in relation to a node usually, this process: - get current metadata from database, if available, or create a new one - dispatch a MetadataLiveEvent, - save new metadata in database, if metadata have been changed during the event - refresh metadata indexes if needed, - prep a new cronjob if an app request it during the event,
public
refreshMetadata(Node $node[, int $process = self::PROCESS_LIVE ][, string $namedEvent = '' ]) : IFilesMetadata
Parameters
- $node : Node
-
related node
- $process : int = self::PROCESS_LIVE
-
type of process
- $namedEvent : string = ''
-
limit process to a named event
Tags
Return values
IFilesMetadatasaveMetadata()
save metadata to database and refresh indexes.
public
saveMetadata(IFilesMetadata $filesMetadata) : void
metadata are saved if new data are available. on update, a check on syncToken is done to avoid conflict (race condition)
Parameters
- $filesMetadata : IFilesMetadata