FileAccess Orion

CronJobNotify extends CronJob
in package
Uses WithSelfRegister

Implement

This class provides the necessary interfaces for

Tags
category

Cronjobs

author

Tobias Teichner webmaster@teichner.biz

since

File available since v3.20.15

Table of Contents

$_progress  : int
internal progress buffer
$dbal  : CronJobDBAL|null
database
$definition  : stdClass|null
the job definition
$id  : int|null
The job id
$log_to_master  : bool
Indicates if logs are transferred to master after execution is done
$multiply  : float
The multiplicator
$name  : string|null
all cron jobs have to implement a name property
$path  : string|null
local absolute storage path
$run_single  : bool
$setup  : stdClass|null
the job information
$git_repo  : Git|null
Git repository
$std_out_log  : bool
__construct()  : mixed
Construct a new instance of the object
Cached()  : bool
Get no cache context
ContextType()  : string
The context type id
Delete()  : Result
Delete instance from database And the folder from file system
Description()  : string
Expose the current description provide an interface to extract/set the current progress of this object
Execute()  : Result
Execute sub job, This one is called after the Register method
Get()  : mixed
GetDefinition()  : stdClass
get setup object (content type defined) load the general plain setup object of this job
GetMultiplicator()  : float
load multiplication load the factor for weighting this job in overall count on jobs executor
GetName()  : string
expose the name provide an interface to extract the name
GetPath()  : string
expose the storage path provide an interface to extract the current path of this object
GetRegistrationTime()  : bool|int
Get registration Get the registration timestamp.
GetStartTime()  : int
Get start time
GetUser()  : User|null
Get current user
Id()  : int|null
IsDone()  : bool
expose the current state provide an interface to extract whether this jo b is running
IsError()  : bool
Set/Get if status is error provide an interface to extract whether this job is error
IsRunning()  : bool
expose the current state provide an interface to extract whether this jo b is running
Logfile()  : string
Path to the log file
LogLine()  : bool
Log line write a line to the local system logfile
LogToMaster()  : bool
The transfer flag
LogToStdOut()  : bool
Target log output switch
Pid()  : false|string
expose the current process pid provide an interface to extract the current Pid of this object
Progress()  : int|null
Expose the current progress
Register()  : Result
Registration handler This method is called when the run at time window is fitting
Repository()  : Git|null
Get the git instance
Restart()  : Result
ResultFile()  : array<string|int, mixed>|null
ResultFiles()  : array<string|int, mixed>|null
ReUse()  : mixed
re-use an existing object with alternative setup set the id to given and the path to null to force a reload
Set()  : mixed
SetDefinition()  : mixed
add setup object (content type defined) buffers the general plain setup object of this job
SetMultiply()  : void
Set the multiplactor
Setup()  : array<string|int, mixed>|null
set/get the current setup
Single()  : bool
Only one instance at a time allowed?
TailLogfile()  : Result
Do log tail
AttachResultFile()  : Result
Database()  : CronJobDBAL|null
Get the database
Employee()  : Employee|null
notify()  : Result
PersistItem()  : Result|null
Store some item in the database to persist it. Like the progress.
Task()  : Task|null

Properties

$_progress

internal progress buffer

protected int $_progress = 0

$definition

the job definition

protected stdClass|null $definition = null

$id

The job id

protected int|null $id = null

$log_to_master

Indicates if logs are transferred to master after execution is done

protected bool $log_to_master = false

$multiply

The multiplicator

protected float $multiply = 0.0

$name

all cron jobs have to implement a name property

protected string|null $name = null

Handlers name

$path

local absolute storage path

protected string|null $path = null

$run_single

protected bool $run_single = false

$setup

the job information

protected stdClass|null $setup = null

$git_repo

Git repository

private Git|null $git_repo = null

$std_out_log

private bool $std_out_log = false

Methods

__construct()

Construct a new instance of the object

public __construct([int $id = null ][, array<string|int, mixed> $setup = null ]) : mixed

This one does not log to master

Parameters
$id : int = null

A cron job identification number

$setup : array<string|int, mixed> = null

A cron job setup data set

Return values
mixed

Cached()

Get no cache context

public Cached() : bool
Tags
inheritDoc
Return values
bool

ContextType()

The context type id

public ContextType() : string
Return values
string

Delete()

Delete instance from database And the folder from file system

public Delete() : Result
Return values
Result

Description()

Expose the current description provide an interface to extract/set the current progress of this object

public Description([string|null $value = null ]) : string
Parameters
$value : string|null = null

The new description

Return values
string

The current description

Execute()

Execute sub job, This one is called after the Register method

public Execute() : Result
Return values
Result

A system result object

Get()

public Get(string $sg, string|null $key[, mixed $default = null ]) : mixed
Parameters
$sg : string
$key : string|null
$default : mixed = null
Return values
mixed

GetDefinition()

get setup object (content type defined) load the general plain setup object of this job

public GetDefinition() : stdClass
Return values
stdClass

a cron job definition from object storage

GetMultiplicator()

load multiplication load the factor for weighting this job in overall count on jobs executor

public GetMultiplicator() : float
Return values
float

weighting of jobs in max buffer context

GetName()

expose the name provide an interface to extract the name

public GetName() : string
Tags
inheritDoc
Return values
string

the object name

GetPath()

expose the storage path provide an interface to extract the current path of this object

public GetPath() : string
Tags
inheritDoc
Return values
string

the object storage path

GetRegistrationTime()

Get registration Get the registration timestamp.

public GetRegistrationTime() : bool|int
Return values
bool|int

The timestamp

GetStartTime()

Get start time

public GetStartTime() : int

Get the start timestamp.

Return values
int

The timestamp

GetUser()

Get current user

public GetUser() : User|null
Tags
inheritDoc
Return values
User|null

Id()

public Id() : int|null
Return values
int|null

IsDone()

expose the current state provide an interface to extract whether this jo b is running

public IsDone([int $value = null ]) : bool
Parameters
$value : int = null

The current progress

Return values
bool

The current progress

IsError()

Set/Get if status is error provide an interface to extract whether this job is error

public IsError([bool|null $value = null ]) : bool
Parameters
$value : bool|null = null

The current progress

Return values
bool

The current progress

IsRunning()

expose the current state provide an interface to extract whether this jo b is running

public IsRunning([int $value = null ]) : bool
Parameters
$value : int = null

The current progress

Return values
bool

The current progress

Logfile()

Path to the log file

public Logfile() : string
Return values
string

LogLine()

Log line write a line to the local system logfile

public LogLine(mixed $value[, string $level = FAA_LOG_LEVEL_INFO ]) : bool
Parameters
$value : mixed

The log message or any kind of object

$level : string = FAA_LOG_LEVEL_INFO

The log level

Tags
inheritDoc
Return values
bool

Write success or false on error

LogToMaster()

The transfer flag

public LogToMaster() : bool
Return values
bool

LogToStdOut()

Target log output switch

public LogToStdOut([bool|null $val = null ]) : bool
Parameters
$val : bool|null = null
Return values
bool

Pid()

expose the current process pid provide an interface to extract the current Pid of this object

public Pid([int|string|null $value = null ]) : false|string
Parameters
$value : int|string|null = null

The current Pid

Return values
false|string

The current Pid

Progress()

Expose the current progress

public Progress([float|int|null $value = null ]) : int|null

Provide an interface to extract the current progress of this object. When a value is given, the progress is set and persisted in the database

Parameters
$value : float|int|null = null

The current progress

Return values
int|null

The current progress

Register()

Registration handler This method is called when the run at time window is fitting

public abstract Register() : Result
Return values
Result

A system result object

Repository()

Get the git instance

public Repository() : Git|null
Return values
Git|null

ResultFile()

public ResultFile(string $name) : array<string|int, mixed>|null
Parameters
$name : string
Return values
array<string|int, mixed>|null

ResultFiles()

public ResultFiles() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

ReUse()

re-use an existing object with alternative setup set the id to given and the path to null to force a reload

public ReUse(int $id) : mixed
Parameters
$id : int

A cronjob identification number

Return values
mixed

Set()

public Set(string $sg, string $key, mixed $data) : mixed
Parameters
$sg : string
$key : string
$data : mixed
Return values
mixed

SetDefinition()

add setup object (content type defined) buffers the general plain setup object of this job

public SetDefinition(stdClass $plain) : mixed
Parameters
$plain : stdClass

A cronjob definition from object storage

Return values
mixed

SetMultiply()

Set the multiplactor

public SetMultiply(float $val) : void
Parameters
$val : float
Return values
void

Setup()

set/get the current setup

public Setup([array<string|int, mixed>|null $value = null ]) : array<string|int, mixed>|null

provide an interface to extract the current setup of this object

Parameters
$value : array<string|int, mixed>|null = null

The new setup

Return values
array<string|int, mixed>|null

The current setup

Single()

Only one instance at a time allowed?

public Single() : bool
Return values
bool

TailLogfile()

Do log tail

public TailLogfile(int $index) : Result

Get the tailing lines of the local log file.

Parameters
$index : int

The start line index

Return values
Result

The result object

AttachResultFile()

protected AttachResultFile(string $source[, string|null $name = null ][, bool $drop = false ]) : Result
Parameters
$source : string

The source file

$name : string|null = null

The target name or null

$drop : bool = false

Drop original?

Return values
Result

Employee()

private Employee(int|string $id) : Employee|null
Parameters
$id : int|string
Return values
Employee|null

PersistItem()

Store some item in the database to persist it. Like the progress.

private PersistItem(string $field, scalar $value) : Result|null
Parameters
$field : string

The database column

$value : scalar

The value

Return values
Result|null

Task()

private Task( $id,  $type) : Task|null
Parameters
$id :
$type :
Return values
Task|null

Search results