Open Journal Systems  2.4.8
 All Classes Namespaces Functions Variables Groups Pages
ScheduledTaskHelper Class Reference

Public Member Functions

 _isInNumericRange ($value, $min, $max)
 
 _isInRange ($rangeStr, $currentValue, $lastTimestamp, $timeCompareStr, $cutoffTimestamp)
 
 _sendEmail ($message, $subject)
 
 checkFrequency ($className, $frequency)
 
 clearExecutionLogs ()
 
 downloadExecutionLog ($file)
 
 getMail ()
 
 getMessage ($executionLogFile)
 
 getTaskArgs ($task)
 
 notifyExecutionResult ($id, $name, $result, $executionLogFile= '')
 
 ScheduledTaskHelper ($email= '', $contactName= '')
 

Detailed Description

Helper class for common scheduled tasks operations.

Definition at line 22 of file ScheduledTaskHelper.inc.php.

Member Function Documentation

ScheduledTaskHelper::_isInNumericRange (   $value,
  $min,
  $max 
)

Check if a numeric value is within the specified range.

Parameters
$valueint
$minint
$maxint
Returns
boolean

Definition at line 278 of file ScheduledTaskHelper.inc.php.

Referenced by _isInRange().

ScheduledTaskHelper::_isInRange (   $rangeStr,
  $currentValue,
  $lastTimestamp,
  $timeCompareStr,
  $cutoffTimestamp 
)

Check if a value is within the specified range.

Parameters
$rangeStrstring the range (e.g., 0, 1-5, *, etc.)
$currentValueint value to check if its in the range
$lastTimestampint the last time the task was executed
$timeCompareStrstring value to use in strtotime("-X $timeCompareStr")
$cutoffTimestampint value will be considered valid if older than this
Returns
boolean

Definition at line 227 of file ScheduledTaskHelper.inc.php.

References _isInNumericRange().

Referenced by checkFrequency().

ScheduledTaskHelper::_sendEmail (   $message,
  $subject 
)

Send email to the site administrator.

Parameters
$messagestring
$subjectstring
Returns
boolean

Definition at line 209 of file ScheduledTaskHelper.inc.php.

References getMail().

Referenced by notifyExecutionResult().

ScheduledTaskHelper::checkFrequency (   $className,
  $frequency 
)

Check if the specified task should be executed according to the specified frequency and its last run time.

Parameters
$classNamestring
$frequencyXMLNode
Returns
string

Definition at line 82 of file ScheduledTaskHelper.inc.php.

References _isInRange(), and DAORegistry\getDAO().

Referenced by AcronPlugin\_getTasksToRun(), and ScheduledTaskTool\parseTasks().

ScheduledTaskHelper::clearExecutionLogs ( )

Clear tasks execution log files.

Definition at line 181 of file ScheduledTaskHelper.inc.php.

Referenced by AdminFunctionsHandler\clearScheduledTaskLogFiles().

ScheduledTaskHelper::downloadExecutionLog (   $file)

Download execution log file.

Parameters
$filestring

Definition at line 192 of file ScheduledTaskHelper.inc.php.

Referenced by AdminFunctionsHandler\downloadScheduledTaskLogFile().

ScheduledTaskHelper::getMail ( )

Get mail object.

Returns
Mail

Definition at line 52 of file ScheduledTaskHelper.inc.php.

Referenced by _sendEmail().

ScheduledTaskHelper::getMessage (   $executionLogFile)

Get execution log email message.

Parameters
$executionLogFilestring
Returns
string

Definition at line 163 of file ScheduledTaskHelper.inc.php.

References PKPApplication\getApplication().

Referenced by notifyExecutionResult().

ScheduledTaskHelper::getTaskArgs (   $task)

Get the arguments for a task from the parsed XML.

Parameters
XMLNode
Returns
array

Definition at line 63 of file ScheduledTaskHelper.inc.php.

Referenced by AcronPlugin\_parseCrontab(), and ScheduledTaskTool\parseTasks().

ScheduledTaskHelper::notifyExecutionResult (   $id,
  $name,
  $result,
  $executionLogFile = '' 
)

Notifies site administrator about the task execution result.

Parameters
$idint Task id.
$namestring Task name.
$resultboolean Whether or not the task execution was successful.
$executionLogFilestring Task execution log file path.

Definition at line 137 of file ScheduledTaskHelper.inc.php.

References _sendEmail(), getMessage(), and Config\getVar().

ScheduledTaskHelper::ScheduledTaskHelper (   $email = '',
  $contactName = '' 
)

Constructor.

Parameters
$emailstring (optional)
$contactNamestring (optional)

Definition at line 35 of file ScheduledTaskHelper.inc.php.

References DAORegistry\getDAO().


The documentation for this class was generated from the following file: