CleanupLogs extends AbstractTask
The cleanup_logs automation task
Table of Contents
Properties
| $date | |
| $logger | |
| $options | |
| $task |
Methods
| __construct() | Initialize a new task |
| loadLanguage() | Attempts to load a language file for use |
| log() | Logs the given content for this task |
| logComplete() | Marks the log completed |
| run() | Executes the task |
| setDate() | Sets the date object for date calculations |
| isCurrentDay() | Determines whether today is the day of the month given |
| isTimeToRun() | Determines whether this task can run at the given date |
| resetErrors() | Reset Input errors on a given object |
| deleteAccountAccessLogs() | Purges account access logs older than the given date |
| deleteClientSettingLogs() | Purges client setting logs older than the given date |
| deleteCompanyLogs() | Delete old logs for the given company |
| deleteContactLogs() | Purges contact logs older than the given date |
| deleteEmailLogs() | Purges email logs older than the given date |
| deleteGatewayLogs() | Purges gateway logs older than the given date |
| deleteMessengerLogs() | Purges messenger logs older than the given date |
| deleteModuleLogs() | Purges module logs older than the given date |
| deleteServiceChangesLogs() | Purges service logs older than the given date |
| deleteServiceLogs() | Purges service logs older than the given date |
| deleteSystemLogs() | Delete old logs for the system |
| deleteTransactionLogs() | Purges transaction logs older than the given date |
| deleteUserLogs() | Purges user logs older than the given date |
Properties
$date
protected
Date
$date
An instance of Minphp\Date\Date
$logger
protected
The
$logger
monolog logger
$options
protected
An
$options
= []
array of options for this task:
- print_log True to print logged content to stdout, or false otherwise (default false)
- cli True if this is being run via the Command-Line Interface, or false otherwise (default true)
$task
protected
An
$task
instance of the task
Methods
__construct()
Initialize a new task
public
__construct(AutomationTypeInterface $task[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $task : AutomationTypeInterface
-
The raw automation task
- $options : array<string|int, mixed> = []
-
An additional options necessary for the task:
- print_log True to print logged content to stdout, or false otherwise (default false)
- cli True if this is being run via the Command-Line Interface, or false otherwise (default true)
loadLanguage()
Attempts to load a language file for use
public
loadLanguage([string $directory = null ][, string $langCode = null ][, string $filename = null ]) : mixed
Parameters
- $directory : string = null
-
The path to the directory containing the language file (optional, defaults to the default language directory)
- $langCode : string = null
-
The ISO 639-1/2 language to load the $filename for (e.g. en_us) (optional, defaults to the current language)
- $filename : string = null
-
The name of the file (without extension) containing the file (optional, attempts to load based on the current task name)
log()
Logs the given content for this task
public
log(string $content) : mixed
Parameters
- $content : string
-
The content to log to cron
logComplete()
Marks the log completed
public
logComplete() : mixed
run()
Executes the task
public
run() : mixed
setDate()
Sets the date object for date calculations
public
setDate(Date $date) : mixed
Parameters
- $date : Date
-
An instance of Minphp\Date\Date
isCurrentDay()
Determines whether today is the day of the month given
protected
isCurrentDay(int $day) : bool
Parameters
- $day : int
-
The day of the month to check (i.e. in range [1,31])
Return values
bool —True if today is the current day given, false otherwise
isTimeToRun()
Determines whether this task can run at the given date
protected
isTimeToRun() : bool
Return values
bool —True if it is time for the task to run, or false otherwise
resetErrors()
Reset Input errors on a given object
protected
resetErrors(object $object) : mixed
Parameters
- $object : object
-
An instance of an object containing the Input component
deleteAccountAccessLogs()
Purges account access logs older than the given date
private
deleteAccountAccessLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteClientSettingLogs()
Purges client setting logs older than the given date
private
deleteClientSettingLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteCompanyLogs()
Delete old logs for the given company
private
deleteCompanyLogs(stdClass $data) : mixed
Parameters
- $data : stdClass
-
The cleanup logs task data
deleteContactLogs()
Purges contact logs older than the given date
private
deleteContactLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteEmailLogs()
Purges email logs older than the given date
private
deleteEmailLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteGatewayLogs()
Purges gateway logs older than the given date
private
deleteGatewayLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteMessengerLogs()
Purges messenger logs older than the given date
private
deleteMessengerLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteModuleLogs()
Purges module logs older than the given date
private
deleteModuleLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteServiceChangesLogs()
Purges service logs older than the given date
private
deleteServiceChangesLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteServiceLogs()
Purges service logs older than the given date
private
deleteServiceLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteSystemLogs()
Delete old logs for the system
private
deleteSystemLogs() : mixed
deleteTransactionLogs()
Purges transaction logs older than the given date
private
deleteTransactionLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs
deleteUserLogs()
Purges user logs older than the given date
private
deleteUserLogs(string $date) : mixed
Parameters
- $date : string
-
The date before which to delete logs