Cleaner implements IErrorable, IVolumeTimeLimit uses TimeLimit
Disk cleanlier class.
Table of Contents
Interfaces
Constants
- AGENT_INTERVAL = 10
- MAX_FILE_PER_INTERACTION = 1000
- MAX_FOLDER_PER_INTERACTION = 1000
- STATUS_FIX_INTERVAL = 20
- STEPPER_OPTION_ID = 'main.stepper.disk'
Methods
- __construct() : mixed
- addWorker() : bool
- Adds delayed delete worker agent.
- agentName() : string
- Returns agent's name.
- canAgentUseCrontab() : bool
- Checks ability agent to use Crontab.
- cancelWorkers() : void
- Cancels all agent process.
- checkRestoreWorkers() : int
- Check if workers exists. Sets up/removes missing task. Remove stepper info.
- checkTimeEnd() : bool
- Checks timer for time limitation.
- className() : string
- Returns the fully qualified name of this class.
- clearProgressInfo() : void
- Remove stepper progress bar.
- collectError() : void
- Adds an array of errors to the collection.
- countWorker() : int
- Count worker agent for user.
- deleteFile() : bool
- Deletes file.
- deleteFileByFilter() : bool
- Deletes files corresponding to indicator filter.
- deleteFileUnnecessaryVersion() : bool
- Deletes file unnecessary versions.
- deleteFolder() : bool
- Deletes folder.
- deleteTrashcanByFilter() : bool
- Deletes files in trashcan.
- deleteUnnecessaryVersionByFilter() : bool
- Deletes unused file versions.
- getDroppedFileCount() : int
- Gets dropped file count.
- getDroppedFolderCount() : int
- Gets dropped folder count.
- getDroppedVersionCount() : int
- Gets dropped version count.
- getErrorByCode() : Error|null
- Returns an error with the necessary code.
- getErrors() : array<string|int, Error>
- Getting array of errors.
- getErrorsByCode() : array<string|int, Error>
- Returns array of errors with the necessary code.
- getOwner() : User
- Gets task owner.
- getOwnerId() : int
- Gets task owner id.
- getProgressInfo() : array<string|int, mixed>|null
- Set up information showing at stepper progress bar.
- getTimeLimit() : int
- Gets limitation time in seconds.
- hasErrors() : bool
- hasTimeLimitReached() : bool
- Tells true if time limit reached.
- instanceTask() : Task
- Gets task.
- instanceTimer() : Timer
- Gets timer.
- isAllowClearFolder() : bool
- Check ability to empty folder.
- isAllowClearStorage() : bool
- Check ability to clear storage.
- isAllowDeleteFolder() : bool
- Check ability to drop folder.
- isCronRun() : bool
- Determines if a script is loaded via cron/command line.
- loadTask() : bool
- Loads task.
- repeatMeasure() : bool
- Repeats measurement for indicator.
- runProcess() : string
- runWorker() : string
- setProgressInfo() : void
- Set up information showing at stepper progress bar.
- setTimeLimit() : static
- Sets limitation time in seconds.
- setTimer() : void
- Sets start up time.
- startTimer() : void
- Sets start up time.
Constants
AGENT_INTERVAL
public
mixed
AGENT_INTERVAL
= 10
MAX_FILE_PER_INTERACTION
public
mixed
MAX_FILE_PER_INTERACTION
= 1000
MAX_FOLDER_PER_INTERACTION
public
mixed
MAX_FOLDER_PER_INTERACTION
= 1000
STATUS_FIX_INTERVAL
public
mixed
STATUS_FIX_INTERVAL
= 20
STEPPER_OPTION_ID
public
mixed
STEPPER_OPTION_ID
= 'main.stepper.disk'
Methods
__construct()
public
__construct([int $ownerId = DiskSystemUser::SYSTEM_USER_ID ]) : mixed
Parameters
- $ownerId : int = DiskSystemUser::SYSTEM_USER_ID
-
Whom will mark as deleted by.
addWorker()
Adds delayed delete worker agent.
public
static addWorker([array<string|int, mixed> $params = [] ]) : bool
Parameters
- $params : array<string|int, mixed> = []
-
Named parameters:
int ownerId - who is owner, int filterId - as row private id from b_disk_volume as filter id, int storageId - limit only one storage int delay - number seconds to delay first execution bool DROP_UNNECESSARY_VERSION - set job to delete unused version, bool DROP_TRASHCAN - set job to empty trashcan. bool DROP_FOLDER - set job to drop everything. bool EMPTY_FOLDER - set job to empty folder structure.
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
boolcancelWorkers()
Cancels all agent process.
public
static cancelWorkers([int $ownerId = -1 ]) : void
Parameters
- $ownerId : int = -1
-
Whom will mark as deleted by.
checkRestoreWorkers()
Check if workers exists. Sets up/removes missing task. Remove stepper info.
public
static checkRestoreWorkers([int $ownerId = -1 ]) : int
Parameters
- $ownerId : int = -1
-
Whom will mark as deleted by.
Return values
intcheckTimeEnd()
Checks timer for time limitation.
public
checkTimeEnd() : bool
Return values
boolclassName()
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.
collectError()
Adds an array of errors to the collection.
public
collectError(array<string|int, Error>|Error $errors[, bool $increaseTaskFail = true ][, bool $raiseTaskFatalError = false ]) : void
Parameters
- $errors : array<string|int, Error>|Error
-
Raised error.
- $increaseTaskFail : bool = true
-
Increase error count in task.
- $raiseTaskFatalError : bool = false
-
Raise task fatal error.
countWorker()
Count worker agent for user.
public
static countWorker([int $ownerId = -1 ]) : int
Parameters
- $ownerId : int = -1
Return values
intdeleteFile()
Deletes file.
public
deleteFile(File $file) : bool
Parameters
- $file : File
-
File to drop.
Return values
booldeleteFileByFilter()
Deletes files corresponding to indicator filter.
public
deleteFileByFilter(IVolumeIndicator $indicator) : bool
Parameters
- $indicator : IVolumeIndicator
-
Ignited indicator for file list filter.
Return values
booldeleteFileUnnecessaryVersion()
Deletes file unnecessary versions.
public
deleteFileUnnecessaryVersion(File $file[, array<string|int, mixed> $additionalFilter = [] ]) : bool
Parameters
- $file : File
-
File to purify.
- $additionalFilter : array<string|int, mixed> = []
-
Additional filter for vertion selection.
Return values
booldeleteFolder()
Deletes folder.
public
deleteFolder(Folder $folder[, bool $emptyOnly = false ]) : bool
Parameters
- $folder : Folder
-
Folder to drop.
- $emptyOnly : bool = false
-
Just delete folder's content.
Return values
booldeleteTrashcanByFilter()
Deletes files in trashcan.
public
deleteTrashcanByFilter(IVolumeIndicator $indicator) : bool
Parameters
- $indicator : IVolumeIndicator
-
Ignited indicator for file list filter.
Return values
booldeleteUnnecessaryVersionByFilter()
Deletes unused file versions.
public
deleteUnnecessaryVersionByFilter(IVolumeIndicator $indicator) : bool
Parameters
- $indicator : IVolumeIndicator
-
Ignited indicator for file list filter.
Return values
boolgetDroppedFileCount()
Gets dropped file count.
public
getDroppedFileCount() : int
Return values
intgetDroppedFolderCount()
Gets dropped folder count.
public
getDroppedFolderCount() : int
Return values
intgetDroppedVersionCount()
Gets dropped version count.
public
getDroppedVersionCount() : int
Return values
intgetErrorByCode()
Returns an error with the necessary code.
public
getErrorByCode(string|int $code) : Error|null
Parameters
- $code : string|int
-
The code of the error.
Return values
Error|nullgetErrors()
Getting array of errors.
public
getErrors() : array<string|int, Error>
Return values
array<string|int, Error>getErrorsByCode()
Returns array of errors with the necessary code.
public
getErrorsByCode(string $code) : array<string|int, Error>
Parameters
- $code : string
-
Code of error.
Return values
array<string|int, Error>getOwner()
Gets task owner.
public
getOwner() : User
Return values
UsergetOwnerId()
Gets task owner id.
public
getOwnerId() : int
Return values
intgetProgressInfo()
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>|nullgetTimeLimit()
Gets limitation time in seconds.
public
getTimeLimit() : int
Return values
inthasErrors()
public
hasErrors() : bool
Return values
boolhasTimeLimitReached()
Tells true if time limit reached.
public
hasTimeLimitReached() : bool
Return values
boolinstanceTask()
Gets task.
public
instanceTask() : Task
Return values
TaskinstanceTimer()
Gets timer.
public
instanceTimer() : Timer
Return values
TimerisAllowClearFolder()
Check ability to empty folder.
public
isAllowClearFolder(Folder $folder) : bool
Parameters
- $folder : Folder
-
Folder to clear.
Return values
boolisAllowClearStorage()
Check ability to clear storage.
public
isAllowClearStorage(Storage $storage) : bool
Parameters
- $storage : Storage
-
Storage to clear.
Return values
boolisAllowDeleteFolder()
Check ability to drop folder.
public
isAllowDeleteFolder(Folder $folder) : bool
Parameters
- $folder : Folder
-
Folder to drop.
Return values
boolisCronRun()
Determines if a script is loaded via cron/command line.
public
static isCronRun() : bool
Return values
boolloadTask()
Loads task.
public
loadTask(int $filterId[, int $ownerId = DiskSystemUser::SYSTEM_USER_ID ]) : bool
Parameters
- $filterId : int
-
Id of saved indicator result from b_disk_volume.
- $ownerId : int = DiskSystemUser::SYSTEM_USER_ID
-
Whom will mark as deleted by.
Return values
boolrepeatMeasure()
Repeats measurement for indicator.
public
static repeatMeasure(IVolumeIndicator $indicator) : bool
Parameters
- $indicator : IVolumeIndicator
-
Ignited indicator for measure.
Return values
boolrunProcess()
public
static runProcess() : string
Return values
stringrunWorker()
public
static runWorker(int $filterId) : string
Parameters
- $filterId : int
Tags
Return values
stringsetProgressInfo()
Set up information showing at stepper progress bar.
public
static setProgressInfo(int $ownerId, int $totalFilesToDrop[, int $droppedFilesCount = 0 ][, int $failCount = 0 ]) : void
Parameters
- $ownerId : int
-
Whom will mark as deleted by.
- $totalFilesToDrop : int
-
Total files to drop.
- $droppedFilesCount : int = 0
-
Dropped files count.
- $failCount : int = 0
-
Failed deletion count.
setTimeLimit()
Sets limitation time in seconds.
public
setTimeLimit(int $timeLimit) : static
Parameters
- $timeLimit : int
-
Timeout in seconds.
Return values
staticsetTimer()
Sets start up time.
public
setTimer(Timer $timer) : void
Parameters
- $timer : Timer
startTimer()
Sets start up time.
public
startTimer() : void