Cleaner
Task cleanlier class.
Table of Contents
Constants
- AGENT_INTERVAL = 60
- DROP_ACTIVITY = 'DROP_ACTIVITY'
- DROP_ENTITY = 'DROP_ENTITY'
- DROP_EVENT = 'DROP_EVENT'
- DROP_FILE = 'DROP_FILE'
- TASK_STATUS_CANCEL = 4
- TASK_STATUS_DONE = 3
- TASK_STATUS_NONE = 0
- TASK_STATUS_RUNNING = 2
- TASK_STATUS_WAIT = 1
Methods
- addWorker() : bool
- Adds delayed delete worker agent.
- agentName() : string
- Returns agent's name.
- canAgentUseCrontab() : bool
- Checks ability agent to use Crontab.
- cancelWorker() : void
- Cancels all agent process.
- className() : string
- Returns the fully qualified name of this class.
- clearProgressInfo() : void
- Remove stepper progress bar.
- countWorker() : int
- Count worker agent for user.
- fixState() : bool
- Saves task state.
- getCountToDrop() : int
- Gets count to drop.
- getDroppedCount() : int
- Gets dropped smt count.
- getFailCount() : int
- Gets fail count.
- getId() : int
- Gets task id.
- getIndicator() : IVolumeIndicator|null
- Returns object indicator corresponding to task.
- getIndicatorType() : string
- Returns indicator class name.
- getIterationCount() : int
- Gets count loaded by filter for iteration.
- getLastError() : int
- Gets last error text occurred in iteration.
- getLastId() : int
- Gets last file id.
- getOwnerId() : int
- Gets task owner id.
- getParam() : string|int|null
- Gets task parameter.
- getProgressInfo() : array<string|int, mixed>|null
- Set up information showing at stepper progress bar.
- getStatus() : int
- Gets task status.
- getStatusSubTask() : int
- Gets task status.
- hasFatalError() : bool
- Has fatal error.
- hasTaskFinished() : bool
- Checks if all have deleted.
- hasUserCanceled() : bool
- Check user cancel task.
- isCronRun() : bool
- Determines if a script is loaded via cron/command line.
- isRunningMode() : bool
- Checks if status is in running mode.
- loadTaskById() : bool
- Loads task params from db.
- raiseFatalError() : self
- Set fatal error.
- runProcess() : string
- Main cleaning agent.
- runWorker() : string
- setDroppedCount() : self
- Sets dropped smt count.
- setFailCount() : self
- Sets fail count.
- setIndicatorType() : self
- Sets indicator type.
- setIterationCount() : self
- Sets count loaded by filter for iteration.
- setLastError() : self
- Sets last error text occurred in iteration.
- setLastId() : self
- Sets last proceeded id.
- setOwnerId() : self
- Sets task owner id.
- setParam() : self
- Sets task parameter.
- setProgressInfo() : void
- Set up information showing at stepper progress bar.
- setStatus() : self
- Sets task status.
- setStatusSubTask() : self
- Sets task status.
Constants
AGENT_INTERVAL
public
mixed
AGENT_INTERVAL
= 60
DROP_ACTIVITY
public
mixed
DROP_ACTIVITY
= 'DROP_ACTIVITY'
DROP_ENTITY
public
mixed
DROP_ENTITY
= 'DROP_ENTITY'
DROP_EVENT
public
mixed
DROP_EVENT
= 'DROP_EVENT'
DROP_FILE
public
mixed
DROP_FILE
= 'DROP_FILE'
TASK_STATUS_CANCEL
public
mixed
TASK_STATUS_CANCEL
= 4
TASK_STATUS_DONE
public
mixed
TASK_STATUS_DONE
= 3
TASK_STATUS_NONE
public
mixed
TASK_STATUS_NONE
= 0
TASK_STATUS_RUNNING
public
mixed
TASK_STATUS_RUNNING
= 2
TASK_STATUS_WAIT
public
mixed
TASK_STATUS_WAIT
= 1
Methods
addWorker()
Adds delayed delete worker agent.
public
static addWorker(array<string|int, mixed> $params, IVolumeIndicator $indicator) : bool
Parameters
- $params : array<string|int, mixed>
-
Named parameters: int ownerId - who is owner, int taskId - as row private id from b_crm_volume as task id, int delay - number seconds to delay first execution string filter - filter bool DROP_ENTITY - set job to drop entity bool DROP_FILE - set job to drop file bool DROP_EVENT - set job to drop event bool DROP_ACTIVITY - set job to drop activity.
- $indicator : IVolumeIndicator
-
Indicator to setup agent.
Return values
boolagentName()
Returns agent's name.
public
static agentName() : string
Return values
stringcanAgentUseCrontab()
Checks ability agent to use Crontab.
public
static canAgentUseCrontab() : bool
Return values
boolcancelWorker()
Cancels all agent process.
public
static cancelWorker([int $ownerId = -1 ]) : void
Parameters
- $ownerId : int = -1
-
Whom will mark as deleted by.
className()
Returns the fully qualified name of this class.
public
static className() : string
Return values
stringclearProgressInfo()
Remove stepper progress bar.
public
static clearProgressInfo([int $ownerId = -1 ]) : void
Parameters
- $ownerId : int = -1
-
Whom will mark as deleted by.
countWorker()
Count worker agent for user.
public
static countWorker([int $ownerId = -1 ]) : int
Parameters
- $ownerId : int = -1
-
Whom will mark as deleted by.
Return values
intfixState()
Saves task state.
public
fixState([string $subTask = '' ]) : bool
Parameters
- $subTask : string = ''
-
Subtask code.
Return values
boolgetCountToDrop()
Gets count to drop.
public
getCountToDrop(string $subTask) : int
Parameters
- $subTask : string
-
Sub task to check.
Return values
intgetDroppedCount()
Gets dropped smt count.
public
getDroppedCount(string $subTask) : int
Parameters
- $subTask : string
-
Sub task to check.
Return values
intgetFailCount()
Gets fail count.
public
getFailCount() : int
Return values
intgetId()
Gets task id.
public
getId() : int
Return values
intgetIndicator()
Returns object indicator corresponding to task.
public
getIndicator() : IVolumeIndicator|null
Tags
Return values
IVolumeIndicator|nullgetIndicatorType()
Returns indicator class name.
public
getIndicatorType() : string
Return values
stringgetIterationCount()
Gets count loaded by filter for iteration.
public
getIterationCount() : int
Return values
intgetLastError()
Gets last error text occurred in iteration.
public
getLastError() : int
Return values
intgetLastId()
Gets last file id.
public
getLastId() : int
Return values
intgetOwnerId()
Gets task owner id.
public
getOwnerId() : int
Return values
intgetParam()
Gets task parameter.
public
getParam(string $code) : string|int|null
Parameters
- $code : string
-
Parameter code.
Return values
string|int|nullgetProgressInfo()
Set up information showing at stepper progress bar.
public
static getProgressInfo(int $ownerId) : array<string|int, mixed>|null
Parameters
- $ownerId : int
-
Whom will mark as deleted by.
Return values
array<string|int, mixed>|nullgetStatus()
Gets task status.
public
getStatus() : int
Return values
intgetStatusSubTask()
Gets task status.
public
getStatusSubTask(string $subTask) : int
Parameters
- $subTask : string
-
Subtask code.
Return values
inthasFatalError()
Has fatal error.
public
hasFatalError() : bool
Return values
boolhasTaskFinished()
Checks if all have deleted.
public
hasTaskFinished(string $subTask) : bool
Parameters
- $subTask : string
-
Sub task to check.
Return values
boolhasUserCanceled()
Check user cancel task.
public
hasUserCanceled() : bool
Return values
boolisCronRun()
Determines if a script is loaded via cron/command line.
public
static isCronRun() : bool
Return values
boolisRunningMode()
Checks if status is in running mode.
public
static isRunningMode(int $status[, array<string|int, int> $runningStatus = array(self::TASK_STATUS_WAIT, self::TASK_STATUS_RUNNING) ]) : bool
Parameters
- $status : int
-
Status to check.
- $runningStatus : array<string|int, int> = array(self::TASK_STATUS_WAIT, self::TASK_STATUS_RUNNING)
-
This statuses are in running mode.
Return values
boolloadTaskById()
Loads task params from db.
public
loadTaskById(int $taskId[, int $ownerId = 0 ]) : bool
Parameters
- $taskId : int
-
Id of saved indicator result from b_crm_volume.
- $ownerId : int = 0
-
Task owner id.
Return values
boolraiseFatalError()
Set fatal error.
public
raiseFatalError() : self
Return values
selfrunProcess()
Main cleaning agent.
public
static runProcess() : string
Return values
stringrunWorker()
public
static runWorker(int $taskId) : string
Parameters
- $taskId : int
-
Id of saved indicator result from b_disk_volume.
Tags
Return values
stringsetDroppedCount()
Sets dropped smt count.
public
setDroppedCount(string $subTask, int $count) : self
Parameters
- $subTask : string
-
Sub task to check.
- $count : int
-
Amount to set.
Return values
selfsetFailCount()
Sets fail count.
public
setFailCount(int $count) : self
Parameters
- $count : int
-
Amount to set.
Return values
selfsetIndicatorType()
Sets indicator type.
public
setIndicatorType(string $indicatorType) : self
Parameters
- $indicatorType : string
-
Indicator class name.
Return values
selfsetIterationCount()
Sets count loaded by filter for iteration.
public
setIterationCount(int $iterationCount) : self
Parameters
- $iterationCount : int
-
Count rows in result set.
Return values
selfsetLastError()
Sets last error text occurred in iteration.
public
setLastError(string $errorText) : self
Parameters
- $errorText : string
-
Error text to save.
Return values
selfsetLastId()
Sets last proceeded id.
public
setLastId(int $lastId) : self
Parameters
- $lastId : int
-
Last proceeded id.
Return values
selfsetOwnerId()
Sets task owner id.
public
setOwnerId(int $ownerId) : self
Parameters
- $ownerId : int
-
Owner id.
Return values
selfsetParam()
Sets task parameter.
public
setParam(string $code, string $value) : self
Parameters
- $code : string
-
Parameter code.
- $value : string
-
Parameter value.
Return values
selfsetProgressInfo()
Set up information showing at stepper progress bar.
public
static setProgressInfo(int $ownerId, int $totalToDrop[, int $droppedCount = 0 ][, int $failCount = 0 ]) : void
Parameters
- $ownerId : int
-
Whom will mark as deleted by.
- $totalToDrop : int
-
Total smt to drop.
- $droppedCount : int = 0
-
Dropped smt count.
- $failCount : int = 0
-
Failed deletion count.
setStatus()
Sets task status.
public
setStatus(int $status) : self
Parameters
- $status : int
-
Task status.
Return values
selfsetStatusSubTask()
Sets task status.
public
setStatusSubTask(string $subTask, int $status) : self
Parameters
- $subTask : string
-
Subtask code.
- $status : int
-
Subtask status.