PruneFailedJobsJob
extends MaintenanceJob
in package
Prunes old rows from the queue failed_jobs table.
When the database queue driver is in use, failed jobs are retained indefinitely. This job deletes failed jobs older than the retention window. It is a no-op when the queue tables are not present (the database queue is optional and may not be configured for a given installation).
The failed_jobs.failed_at column stores a Unix timestamp.
Arguments:
- max_age_days: retention window in days (default 30)
Table of Contents
Methods
- getName() : string
- run() : bool
- Delete failed jobs older than the retention window.
- getBasePath() : string|null
- Resolve the application base path from the Registry.
- getConnection() : PDO|null
- Build a PDO connection from the application database settings.
- getSettings() : SettingManager|null
- Resolve the application SettingManager from the Registry.
- intArg() : int
- Read an integer argument with a default fallback.
- tableExists() : bool
- Determine whether the failed_jobs table exists.
Methods
getName()
public
getName() : string
Tags
Return values
stringrun()
Delete failed jobs older than the retention window.
public
run([array<string|int, mixed> $argv = [] ]) : bool
Parameters
- $argv : array<string|int, mixed> = []
Return values
bool —True on success (including the no-op when no queue tables).
getBasePath()
Resolve the application base path from the Registry.
protected
getBasePath() : string|null
Return values
string|nullgetConnection()
Build a PDO connection from the application database settings.
protected
getConnection() : PDO|null
Return values
PDO|null —Null when the connection cannot be established.
getSettings()
Resolve the application SettingManager from the Registry.
protected
getSettings() : SettingManager|null
Return values
SettingManager|null —Null when settings are unavailable.
intArg()
Read an integer argument with a default fallback.
protected
intArg(array<string|int, mixed> $argv, string $key, int $default) : int
Parameters
- $argv : array<string|int, mixed>
- $key : string
- $default : int
Return values
inttableExists()
Determine whether the failed_jobs table exists.
private
tableExists(PDO $pdo) : bool
Parameters
- $pdo : PDO