SproutCMS

This is the code documentation for the SproutCMS project

class Worker

Functions called by worker libraries to indicate status, etc

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2026-09-16
**/
class NewClassName extends Worker {
    
    /**
    * Shutdown function, for catching fatal errors
    **/
    public function shutdown () {
        // Method code goes here
    }
    
    /**
    * Save and output log message for the currently running worker job
    **/
    public function message (string $message) {
        // Method code goes here
    }
    
    /**
    * Set a metric
    **/
    public function metric (int $num, int $value) {
        // Method code goes here
    }
    
    /**
    * Report that a worker job failed.
    * Terminates the script.
    **/
    public function failure (string $message) {
        // Method code goes here
    }
    
    /**
    * Report the successful completion of the worker job.
    * Terminates the script.
    **/
    public function success () {
        // Method code goes here
    }
    
    /**
    * Exception and error handling for worker jobs
    **/
    public function exceptionHandler ($exception, $message, $file, $line) {
        // Method code goes here
    }
    
    /**
    * Called just before the worker thread is started.
    **/
    public function start ($job_id) {
        // Method code goes here
    }
    
}
?>