![No UI](https://img.shields.io/static/v1?label=UI&message=none&color=inactive) The "Auto Delete Task" plugin will automatically delete assets that have reached a certain age. This is useful in a "transfer folder" scenario, where assets are only uploaded in order to be transferred to some 3rd party via PIN-code or similar, whereafter the assets are no longer needed. [MINITOC] ## General properties To be configured in {home}/appserver/conf/custom.properties ##### autoDeleteTask.license > type: String, **required: yes**, default: - The license key for the plugin (product: autoDeleteTask), provided by *brix*. ##### autoDeleteTask.dryRun > type: boolean, required: no, default: false, since: 2.0 When enabled, no action will actually be taken, but the task log will show what it would have done. Useful for testing your initial config. ##### ~~autoDeleteTask.nodesMaxAgeHours~~ > type: List of String (comma-separated), **DEPRECATED, use task properties**, default: - Defines a mapping from nodes to their max age (relative to the creation date of the asset) in hours, after which its content should be deleted. For example `1400:24,1800:168` will delete assets older than 24h in node 1400, and assets older than 7 days in node 1800. ##### guiPlugin.bullets.node > type: List of String (comma-separated), default: `subscription,driveSync` If you want to enable the node bullet to see which nodes are subject to auto-deletion, add `autoDeleteTask` to the system setting `guiPlugin.bullets.node`. E.g. `guiPlugin.bullets.node=subscription,driveSync,autoDeleteTask` ![node bullet](bullet.png) ## Task properties This plugin can have multiple different configurations (as of 2.0) in the format of autoDeleteTask._i_.something, where _i_ is a number. We''l use i = 1 as an example here: ##### autoDeleteTask.1.enabled > type: boolean, required: no, default: true, since: 2.0 Whether this particular config is enabled or not. ##### autoDeleteTask.1.nodeId > type: long, required: **probably**, except when `nodeTypeId` is configured, default: - , since: 2.0 Which node to look for old assets (or nodes) in, recursively. When neither this nor `nodeTypeId` is set, the config will be disabled. ##### autoDeleteTask.1.nodeTypeId > type: long, required: **maybe**, when `nodeId` is not configured, default: - , since: 2.0 Same as _nodeId_, but it looks in an entire node type (a.k.a. main view tab). When neither this nor `nodeTypeId` is set, the config will be disabled. ##### autoDeleteTask.1.maxAge > type: long, required: **yes**, default: - , since: 2.0 What the maximum age (in hours) of an asset or node should be, before it gets deleted/unlinked. If this is not set, the config will be disabled. ##### autoDeleteTask.1.nodeMode > type: boolean, required: no, default: false, since: 2.0 In nodeMode, the subnodes of the configured node (-type) will be checked for their age and scheduled for deletion, regardless of whether they contain assets or not. Probably only useful for non-premission-defining nodes (e.g. collections). ##### autoDeleteTask.1.notIfLinkedToOtherNodes > type: boolean, required: no, default: true, since: 2.0 If the asset is also linked to other nodes, just unlink it from the current node instead of deleting it. Only applies when `nodeMode=false`. ##### autoDeleteTask.1.cleanUpEmptyFolders > type: boolean, required: no, default: true, since: 2.0 When empty folders are left behind through deletion of the contained assets, remove the (now empty) folder as well. Only applies when `nodeMode=false`. ##### autoDeleteTask.1.notIfHasChildNodes > type: boolean, required: no, default: true, since: 2.0 Whether to leave a node untouched when it still contains sub-nodes. Only applies when `nodeMode=true`. ##### autoDeleteTask.1.relevantDateField > type: String, required: no, default: created, since: 2.0 Which date field to consider when determining the age of an asset or node. One of `created` (default), `modified` or `binary` (assets only). ##### autoDeleteTask.1.scope > type: String, required: no, default: -, since: 2.2 In addition to [nodeId](#auto-delete-task-1-node-id) or [nodeTypeId](#auto-delete-task-1-node-type-id), define arbitrary restrictions based on a [SearchUtil2](/celum_extensions/search_util_2) expression. These will be ANDed to the node(Type)Id when running the task, e.g. `...scope=fileExtension=zip` to only remove ZIP files. ## Example ```ini ### Auto Delete Task autoDeleteTask.license=... # remove from trashbin after 30d autoDeleteTask.1.nodeId=1685 autoDeleteTask.1.maxAge=720 autoDeleteTask.1.relevantDateField=modified # remove collections after 1y autoDeleteTask.2.nodeTypeId=102 autoDeleteTask.2.maxAge=8760 autoDeleteTask.2.nodeMode=true ``` ## Compatibility Matrix | autoDeleteTask | CELUM (min. version) | |:-------------- |:------------------------- | | 1.0 - 1.1 | 5.12.2 | | 1.2 - 1.3 | 5.12.3 (tested up to 6.4) | | 2.0 - 2.1 | 5.12.3 (tested up to 6.8) | | 2.2 | 6.4.0 (tested up to 6.16) | | 2.3 | 6.14.0 (tested up to 6.16)| ## Release Notes #### 1.0 > Released: 2016-07-22 * Initial Version #### 1.1 > Released: 2016-09-16 * Added the [unlink](#autodeletetask-notiflinkedtoothernodes) feature #### 1.2 > Released: 2018-01-18 * made the extension trashbin-aware (i.e. if you have a trashbin, deleting an asset would only move it to the trashbin - now it gets deleted from there as well) #### 1.3 > Released: 2019-01-25 * added license check #### 2.0 > Released: 2020-07-06 * Refactoring to allow multiple auto delete configurations (partially a **breaking change**, `nodesMaxAgeHours` will be auto-converted to the new format (nodeId= and maxAge=), the rest won't) * Enable deletion on an entire node type * Enable deletion of nodes (until now only nodes that were empty because assets were removed from it could be auto-deleted) * Added configurable date source (until now only the modification date was considered) #### 2.1 > Released: 2021-04-06 * Added node bullet feature #### 2.2 > Released 2022-06-08 * refactored to use @DynamicProperties * added [scope](#auto-delete-task-1-scope) #### 2.3 > Released 2024-04-11 * bump min. versionto CELUM 6.14 (for better search-utils)