Page tree
Skip to end of metadata
Go to start of metadata

The Tasks Cleaner module provides commands for managing tasks like scheduled publications that have been executed.

Tasks that have been successfully executed are marked as "resolved" and retained in the task workspace in your JCR repository. Resolved tasks can be marked as "archived" and will no longer be displaced in the Tasks app. "Archived" tasks can be marked as "removed".

Having many resolved tasks can affect:

  • the time to log in to Admincentral
  • the time to publish

It's a good idea to periodically archive resolved tasks to prevent Admincentral performance from being adversely impacted.

JIRA-
Gittaskscleaner

Installation

Maven is the easiest way to install the module. Add the following dependency to your bundle:

<dependency>
  <groupId>info.magnolia.taskscleaner</groupId>
  <artifactId>tasks-cleaner</artifactId>
  <version>(current Tasks Cleaner module version)</version>
</dependency>

Versions

1.0Magnolia 5.6

Usage

The following commands are defined by the Tasks Cleaner module: cleanup-archiveTasks and cleanup-removeTasks.

The commands cleanup-archiveTasks and cleanup-removeTasks can be run:

Commands

All the commands can be found in the cleanup catalog: /module/tasks-cleaner/commands/cleanup

archiveTasks

Check resolved tasks and mark selected tasks as archived according to configurable criteria.

removeTasksCheck archived tasks and mark selected task as removed according to configurable criteria.

Both archiveTasks and removeTasks have the following properties: 

Properties:

noop

optional

Do a dry-run, do not modify any tasks and report the results to Magnolia logs.

Default is false.

maxTasks

optional

Sets the maximum number of tasks that will be modified in a run (defaults to 256). If the maximum number of tasks is reached, the command will stop. If set to -1, no limit is imposed and all selected tasks will be modified.

Default is 256.

voters

required

A voter set that will select tasks for modification (either archiving or removal). See the following section on the task voters available.

Task Voters

There are a number of task voters you can use to select tasks for archiving or removing by the archiveTasks and removeTasks commands.

TaskCreatedBeforeVoter

TaskCreatedBeforeVoter returns true if the task was created before a configured date, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskCreatedBeforeVoter

Properties:

date

required

A date. The voter will return true if the task was created before the date.

TaskCreatedSinceVoter

TaskCreatedSinceVoter returns true if the task was created before a configured interval (in milliseconds) from the current time, false otherwise.

For example, if the interval is set to 30 days (2592000000 converted to milliseconds), the voter will return true if the creation date is 30 days before the current time at execution.

Class: info.magnolia.services.taskscleaner.voters.TaskCreatedSinceVoter

Properties:

interval

required

An interval in milliseconds. The voter will return true if the task was created before interval from the current time.

TaskFailedVoter

TaskFailedVoter returns true if the task is marked as "Failed", false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskFailedVoter

TaskHasContentValueVoter

TaskHasContentValueVoter returns true if the task content has the configured contentKey key and contentValue, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskHasContentValueVoter

Properties:

contentKey

required

A content key name.

contentValue

required

A content value.

TaskHasContentVoter

TaskHasContentVoter returns true if the task content has the configured contentKey defined, false otherwise.

Note: the value of the contentKey is not checked.

Class: info.magnolia.services.taskscleaner.voters.TaskHasContentVoter

Properties:

contentKey

required

A content key name.

TaskHasResultValueVoter

TaskHasResultValueVoter returns true if the task results has the configured resultKey key and resultValue, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskHasResultValueVoter

Properties:

resultKey

required

A result key name.

resultValue

required

A result value.

TaskHasResultVoter

TaskHasContentVoter returns true if the task results has the configured resultsKey defined, false otherwise.

Note: the value of the resultKey is not checked.

Class: info.magnolia.services.taskscleaner.voters.TaskHasResultVoter

Properties:

resultKey

required

A result key name.

TaskModifiedBeforeVoter

TaskModifiedBeforeVoter returns true if the task was modified before a configured date, false otherwise.

Class: info.magnolia.services.taskscleaner.voters.TaskModifiedBeforeVoter

Properties:

date

required

A date. The voter will return true if the task was modified before the date.

TaskModifiedSinceVoter

TaskModifiedSinceVoter returns true if the task was modified before a configured interval (in milliseconds) from the current time, false otherwise.

For example, if the interval is set to 30 days (2592000000 converted to milliseconds), the voter will return true if the last modified date is 30 days before the current time at execution.

Class: info.magnolia.services.taskscleaner.voters.TaskModifiedSinceVoter

Properties:

interval

required

An interval in milliseconds. The voter will return true if the task was last modified before interval from the current time.

TaskStatusVoter

TaskStatusVoter returns true if the task currently has the configured status, otherwise false.

Class: info.magnolia.services.taskscleaner.voters.TaskStatusVoter

Properties:

status

required

A task status, one of: Created, InProgress, Resolved, Failed, Archived, Removed, Scheduled.

Warnings

  • This module is at INCUBATOR level.

Changelog

  • Version 1.0
    • initial release