CronDatabase
in package
Database for cron jobs.
Table of Contents
- $connector : DatabaseConnector
- $jobs : array<string|int, mixed>
- $pdo : PDO
- $serverProfile : LAMConfig
- __construct() : mixed
- Constructor
- clearJobRuns() : void
- This deletes all job runs from the database.
- connect() : void
- Connects to the database.
- getConnector() : DatabaseConnector
- Returns the database connector
- getDatabaseConnectors() : array<string|int, mixed>
- Returns a list of database connectors.
- getJobRuns() : array<string|int, JobRun>
- Returns the job runs.
- getJobs() : array<string|int, mixed>
- Returns the jobs to run.
- getPdo() : PDO|null
- Returns the PDO.
- importJobRun() : mixed
- Imports a job run.
- saveJobRun() : void
- Saves a job run in database.
- getDatabaseConnectorByName() : DatabaseConnector
- Returns the database connector object by connector name.
Properties
$connector
private
DatabaseConnector
$connector
connector
$jobs
private
array<string|int, mixed>
$jobs
= []
maps job ID to job object
$pdo
private
PDO
$pdo
PDO
$serverProfile
private
LAMConfig
$serverProfile
Methods
__construct()
Constructor
public
__construct(LAMConfig $config) : mixed
Parameters
- $config : LAMConfig
-
server profile
Tags
Return values
mixed —clearJobRuns()
This deletes all job runs from the database.
public
clearJobRuns() : void
Return values
void —connect()
Connects to the database.
public
connect() : void
Tags
Return values
void —getConnector()
Returns the database connector
public
getConnector() : DatabaseConnector
Return values
DatabaseConnector —connector
getDatabaseConnectors()
Returns a list of database connectors.
public
static getDatabaseConnectors() : array<string|int, mixed>
Return values
array<string|int, mixed> —array of DatabaseConnector
getJobRuns()
Returns the job runs.
public
getJobRuns() : array<string|int, JobRun>
Return values
array<string|int, JobRun> —job runs as JobRun
getJobs()
Returns the jobs to run.
public
getJobs() : array<string|int, mixed>
Return values
array<string|int, mixed> —jobs (id => job object)
getPdo()
Returns the PDO.
public
getPdo() : PDO|null
Return values
PDO|null —importJobRun()
Imports a job run.
public
importJobRun(string $runId, string $name, string $jobId, string $time, bool $isOk, string $message) : mixed
Parameters
- $runId : string
-
run ID
- $name : string
-
job name
- $jobId : string
-
job ID
- $time : string
-
run time
- $isOk : bool
-
result
- $message : string
-
message
Return values
mixed —saveJobRun()
Saves a job run in database.
public
saveJobRun(string $name, string $jobID, int $result[, string $message = null ]) : void
Parameters
- $name : string
-
job name
- $jobID : string
-
job ID
- $result : int
-
return code (default: 0)
- $message : string = null
-
error message (default: null)
Return values
void —getDatabaseConnectorByName()
Returns the database connector object by connector name.
private
getDatabaseConnectorByName(string $connectorName) : DatabaseConnector
Parameters
- $connectorName : string
-
connector name (e.g. "MySQL")
Tags
Return values
DatabaseConnector —connector or null if name is invalid