CleanupJob
class CleanupJob extends AbstractQueuedJob (View source)
An queued job to clean out the QueuedJobDescriptor Table which often gets too full
Traits
Provides extensions to this object to integrate it with standard config API methods.
Config options
| cleanup_method | string | How we will determine "stale" Possible values: age, number  | 
                |
| cleanup_value | int | Value associated with cleanupMethod age => days, number => integer  | 
                |
| cleanup_statuses | array | Which JobStatus values are OK to be deleted  | 
                |
| query_limit | int | Database query limit  | 
                |
| is_enabled | bool | Check whether is enabled or not for BC  | 
                
Properties
| protected | stdClass | $jobData | from AbstractQueuedJob | |
| protected | array | $messages | from AbstractQueuedJob | |
| protected | int | $totalSteps | from AbstractQueuedJob | |
| protected | int | $currentStep | from AbstractQueuedJob | |
| protected | bool | $isComplete | from AbstractQueuedJob | 
Methods
Extensions can have a construct but don't have too.
Sets a data object for persisting by adding its id and type to the serialised vars
Specifies what user ID should be when running the job valid values: null - (default) - run the job as current user 0 - run the job without a user greater than zero - run the job as a specific user
Method for determining whether the job is finished - you may override it if there's more to it than just this
No description
Gets custom config settings to use when running the job.
Sets custom config settings to use when the job is run.
Convenience methods for setting and getting job data
Resolves a queue name to one of the queue constants.
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Details
        
                            
    __construct($params = array())
        
    
    Extensions can have a construct but don't have too.
Without a construct, it's impossible to create a job in the CMS
        
                            string
    getTitle()
        
    
    Defines the title of the job
        
                    protected        
    setObject(DataObject $object, string $name = 'Object')
        
    
    Sets a data object for persisting by adding its id and type to the serialised vars
        
                    protected        DataObject|null
    getObject(string $name = 'Object')
        
    
    No description
        
                            string
    getSignature()
        
    
    Return a signature for this queued job
        
                    protected        string
    randomSignature()
        
    
    Generate a somewhat random signature
useful if you're want to make sure something is always added
        
                            
    getJobType()
        
    
    Set immediacy of job
        
                            int|null
    getRunAsMemberID()
        
    
    Specifies what user ID should be when running the job valid values: null - (default) - run the job as current user 0 - run the job without a user greater than zero - run the job as a specific user
This is useful in situations like:
- a job needs to always run without a user (like a static cache job)
 - a job needs to run as a specific user (for example data migration job)
 
Note that this value can be overridden in the QueuedJobService::queueJob()
        
                            
    setup()
        
    
    Performs setup tasks the first time this job is run.
This is only executed once for every job. If you want to run something on every job restart, use the prepareForRestart method.
        
                            
    prepareForRestart()
        
    
    Run when an already setup job is being restarted.
        
                            
    process()
        
    
    Clear out stale jobs based on the cleanup values
        
                            
    jobFinished()
        
    
    Method for determining whether the job is finished - you may override it if there's more to it than just this
        
                            
    afterComplete()
        
    
    Called when the job is determined to be 'complete'
        
                            
    getJobData()
        
    
    No description
        
                            
    setJobData(int $totalSteps, int $currentStep, bool $isComplete, stdClass $jobData, array $messages)
        
    
    No description
        
                            array|null
    getCustomConfig()
        
    
    Gets custom config settings to use when running the job.
        
                            
    setCustomConfig(array $config)
        
    
    Sets custom config settings to use when the job is run.
        
                            
    addMessage(string $message, string $severity = 'INFO')
        
    
    No description
        
                            
    __set(mixed $name, mixed $value)
        
    
    Convenience methods for setting and getting job data
        
                            mixed
    __get(mixed $name)
        
    
    Retrieve some job data
        
                static            string|null
    getQueue(string|int $queue)
        
    
    Resolves a queue name to one of the queue constants.
If $queue is already the value of one of the constants, it will be returned.
If the queue is unknown, null will be returned.
        
                static            Config_ForClass
    config()
        
    
    Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
        
                            mixed
    uninherited(string $name)
        
    
    Gets the uninherited value for the given config option