CRM_Core_JobManager
in package
This interface defines methods that need to be implemented by every scheduled job (cron task) in CiviCRM.
Tags
Table of Contents
Properties
- $_source : string|null
- $currentJob : CRM_Core_ScheduledJob
- $jobs : array<string|int, CRM_Core_ScheduledJob>
- Jobs.
- $singleRunParams : array<string|int, mixed>
- $logger : LoggerInterface
Methods
- __construct() : mixed
- execute() : mixed
- executeJob() : mixed
- executeJobByAction() : mixed
- executeJobById() : mixed
- logEntry() : mixed
- Add a log entry.
- setSingleRunParams() : mixed
- apiResultToMessage() : string
- createLogContext() : array<string|int, mixed>
- getJob() : CRM_Core_ScheduledJob
- Retrieves specific job from the database by id.
Properties
$_source
public
string|null
$_source
= \NULL
Tags
$currentJob
public
CRM_Core_ScheduledJob
$currentJob
= \NULL
$jobs
Jobs.
public
array<string|int, CRM_Core_ScheduledJob>
$jobs
= \NULL
Format is ($id => CRM_Core_ScheduledJob).
$singleRunParams
public
array<string|int, mixed>
$singleRunParams
= []
Tags
$logger
protected
LoggerInterface
$logger
Methods
__construct()
public
__construct([LoggerInterface|null $logger = null ]) : mixed
Parameters
- $logger : LoggerInterface|null = null
execute()
public
execute([bool $auth = true ]) : mixed
Parameters
- $auth : bool = true
executeJob()
public
executeJob(CRM_Core_ScheduledJob $job) : mixed
Parameters
- $job : CRM_Core_ScheduledJob
executeJobByAction()
public
executeJobByAction(mixed $entity, mixed $action) : mixed
Parameters
- $entity : mixed
- $action : mixed
executeJobById()
public
executeJobById(int $id) : mixed
Parameters
- $id : int
logEntry()
Add a log entry.
public
logEntry(string $message) : mixed
NOTE: This signature has been around forever, and it's used a little bit in contrib. However, you will likely find it more meaningful to call the $logger, as in:
$this->logger->warning("Careful!", $this->createLogContext()); $this->logger->error("Uh oh!", $this->createLogContext());
Parameters
- $message : string
setSingleRunParams()
public
setSingleRunParams(mixed $entity, mixed $job, array<string|int, mixed> $params[, string|null $source = null ]) : mixed
Parameters
- $entity : mixed
- $job : mixed
- $params : array<string|int, mixed>
- $source : string|null = null
apiResultToMessage()
private
apiResultToMessage(mixed $apiResult) : string
Parameters
- $apiResult : mixed
Return values
stringcreateLogContext()
private
createLogContext([mixed $init = [] ]) : array<string|int, mixed>
Parameters
- $init : mixed = []
Return values
array<string|int, mixed>getJob()
Retrieves specific job from the database by id.
private
getJob([int $id = null ][, null $entity = null ][, null $action = null ]) : CRM_Core_ScheduledJob
and creates ScheduledJob object.
Parameters
- $id : int = null
- $entity : null = null
- $action : null = null