### 2.2.0 Alpha 1 (XXXX-YY-ZZ)
+* `options` support for cronjobs.
* `permissions` and `options` support for event listeners.
* `permissions` and `options` support for template listeners.
* `wcf\data\TDatabaseObjectOptions` and `wcf\data\TDatabaseObjectPermissions` for database object-bound options and permissions validation.
<?php
namespace wcf\data\cronjob;
use wcf\data\DatabaseObject;
+use wcf\data\TDatabaseObjectOptions;
use wcf\util\CronjobUtil;
/**
* @category Community Framework
*/
class Cronjob extends DatabaseObject {
+ use TDatabaseObjectOptions;
+
/**
* @see \wcf\data\DatabaseObject::$databaseTableName
*/
// execute cronjob
$exception = null;
- try {
- $executable->execute(new Cronjob($cronjob->cronjobID));
+
+ // check if all required options are set for cronjob to be executed
+ // note: a general log is created to avoid confusion why a cronjob
+ // apperently is not executed while that is indeed the correct internal
+ // behavior
+ if ($cronjob->validateOptions()) {
+ try {
+ $executable->execute(new Cronjob($cronjob->cronjobID));
+ }
+ catch (\Exception $exception) { }
}
- catch (\Exception $exception) { }
CronjobLogEditor::create(array(
'cronjobID' => $cronjob->cronjobID,
));
$logEditor = new CronjobLogEditor($log);
- try {
- $this->executeCronjob($cronjobEditor, $logEditor);
+ // check if all required options are set for cronjob to be executed
+ // note: a general log is created to avoid confusion why a cronjob
+ // apperently is not executed while that is indeed the correct internal
+ // behavior
+ if ($cronjobEditor->validateOptions()) {
+ try {
+ $this->executeCronjob($cronjobEditor, $logEditor);
+ }
+ catch (SystemException $e) {
+ $this->logResult($logEditor, $e);
+ }
}
- catch (SystemException $e) {
- $this->logResult($logEditor, $e);
+ else {
+ $this->logResult($logEditor);
}
// get time of next execution
'className' => (isset($data['elements']['classname'])) ? $data['elements']['classname'] : '',
'description' => (isset($data['elements']['description'])) ? $data['elements']['description'] : '',
'isDisabled' => (isset($data['elements']['isdisabled'])) ? intval($data['elements']['isdisabled']) : 0,
+ 'options' => (isset($data['elements']['options'])) ? $data['elements']['options'] : '',
'startDom' => $data['elements']['startdom'],
'startDow' => $data['elements']['startdow'],
'startHour' => $data['elements']['starthour'],
canBeEdited TINYINT(1) NOT NULL DEFAULT 1,
canBeDisabled TINYINT(1) NOT NULL DEFAULT 1,
state TINYINT(1) NOT NULL DEFAULT 0,
- failCount TINYINT(1) NOT NULL DEFAULT 0
+ failCount TINYINT(1) NOT NULL DEFAULT 0,
+ options TEXT
);
DROP TABLE IF EXISTS wcf1_cronjob_log;