Documentation

CRM_Core_JobManager
in package

This interface defines methods that need to be implemented by every scheduled job (cron task) in CiviCRM.

Tags
copyright

CiviCRM LLC https://civicrm.org/licensing

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
fixme

Looks like this is only used by "singleRun"

$singleRunParams

public array<string|int, mixed> $singleRunParams = []
Tags
fixme

How are these set? What do they do?

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

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
string

createLogContext()

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
Tags
throws
Exception
Return values
CRM_Core_ScheduledJob

        
On this page

Search results