CronJobExportUser
extends CronJob
in package
Uses
WithSingle
Implement user export as background job
This class provides the necessary interfaces for exporting users to a file
Tags
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,
- 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 Provides 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
- RegisterSingle() : Result
- Register new sub jobs
- 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
- getNameFromNumber() : mixed
- PersistItem() : Result|null
- Store some item in the database to persist it. Like the progress.
Properties
$_progress
internal progress buffer
protected
int
$_progress
= 0
$dbal
database
protected
CronJobDBAL|null
$dbal
= null
$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([null|int $id = null ][, null|array<string|int, mixed> $setup = null ]) : mixed
Parameters
- $id : null|int = null
-
A cron job identification number
- $setup : null|array<string|int, mixed> = null
-
A cron job setup data set
Return values
mixed —Cached()
Get no cache context
public
Cached() : bool
Tags
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,
public
Execute() : Result
This one is called after the Register method
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
Return values
string —the object name
GetPath()
Expose the storage path Provides an interface to extract the current path of this object
public
GetPath() : string
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
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
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
Register() : Result
Tags
Return values
Result —A system result object
RegisterSingle()
Register new sub jobs
public
RegisterSingle(array<string|int, mixed> $data) : Result
This method can be used to register a single instance of the job programmatically with setup
Parameters
- $data : array<string|int, mixed>
-
The configuration array
Return values
Result —A system result object
Repository()
Get the git instance
public
Repository() : Git|null
Return values
Git|null —Restart()
public
Restart() : Result
Return values
Result —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 —Database()
Get the database
private
Database() : CronJobDBAL|null
Return values
CronJobDBAL|null —getNameFromNumber()
private
getNameFromNumber(mixed $num) : mixed
Parameters
- $num : mixed
Return values
mixed —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