# Janitor

> See the [Janitor guide](/version-0.x/guide/janitor-guide.md) to learn how to work with the Janitor module.

## Constants

* **`JANITORTASK_EXECUTION_RETURN_WARNING`** Return code for [JanitorTask](/version-0.x/reference/core-classes/janitortask.md) run when task returned a warning.
* **`JANITORTASK_EXECUTION_RETURN_ERROR`** Return code for [JanitorTask](/version-0.x/reference/core-classes/janitortask.md) run when task returned an error.
* **`JANITORTASK_EXECUTION_RETURN_CRITICAL`** Return code for [JanitorTask](/version-0.x/reference/core-classes/janitortask.md) run when task returned a critical error.
* **`JANITORTASK_EXECUTION_RETURN_OK`** Return code for [JanitorTask](/version-0.x/reference/core-classes/janitortask.md) run when task was executed without errors.
* **`JANITORTASK_EXECUTION_PERIODICITY_ONLY_MANUAL`** The task can only be executed when calling the Janitor run process with an specific task parameter. It won't be executed on regular "all-tasks" calls to Janitor.
* **`JANITORTASK_EXECUTION_PERIODICITY_ALWAYS`** The task must be executed every time Janitor run is called.
* **`JANITORTASK_EXECUTION_PERIODICITY_EACH_SECONDS`** The task must be executed every specified seconds. Seconds specified in `periodicityEachSeconds` config key.
* **`JANITORTASK_EXECUTION_PERIODICITY_MINUTES`** The task must be executed on the given minutes of each hour. Desired minutes are specified as an array in the `periodicityMinutes` config key with the syntax: `[0, 15, 30, 45]`
* **`JANITORTASK_EXECUTION_PERIODICITY_HOURS`** The task must be executed on the given hours of each day. Desired hours/minute are specified as an array in the `periodicityHours` config key with the syntax: `["hour:minute", "hour:minute", "hour:minute"]`
* **`JANITORTASK_EXECUTION_PERIODICITY_DAYSOFMONTH`** The task must be executed on the given days of each month. Desired days/hour/minute are specified as an array in the `periodicityDaysOfMonth` config key with the syntax: `["day@hour:minute", "day@hour:minute", "day@hour:minute"]` (Take into account days of month that do not exist)

## Configuration

* **`logDatabaseProviderName`** The name of the DatabaseProvider to use for storing Janitor log. Defaults to `main`.
* **`logTableName`** The name of the table used to store Janitor log. Defaults to `cherrycake_janitor_log`
* **`coreJanitorTasks`** An array of names of the Cherrycake core [JanitorTask](/version-0.x/reference/core-classes/janitortask.md) classes to run. Defaults to an array with the following elements:
  * `JanitorTaskJanitorPurge`
  * `JanitorTaskSystemLogPurge`
  * `JanitorTaskSystemLogCommit`
  * `JanitorTaskSessionPurge`
  * `JanitorTaskStatsCommit`
  * `JanitorTaskLogCommit`
* **`appJanitorTasks`** An array of names of App JanitorTask classes to run.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cherrycake.tin.cat/version-0.x/reference/core-modules/janitor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
