<?php
namespace wcf\acp\form;
+use wcf\data\cronjob\Cronjob;
use wcf\data\cronjob\CronjobAction;
use wcf\data\cronjob\CronjobEditor;
use wcf\form\AbstractForm;
$data = array_merge($this->additionalFields, [
'className' => $this->className,
'packageID' => $this->packageID,
+ 'cronjobName' => 'com.woltlab.wcf.cronjob',
'description' => $this->description,
'startMinute' => $this->startMinute,
'startHour' => $this->startHour,
]);
$this->objectAction = new CronjobAction([], 'create', ['data' => $data]);
- $this->objectAction->executeAction();
+ /** @var Cronjob $cronjob */
+ $cronjob = $this->objectAction->executeAction()['returnValues'];
+ $cronjobID = $cronjob->cronjobID;
+
+ // update `cronjobName`
+ $data = ['cronjobName' => 'com.woltlab.wcf.cronjob' . $cronjobID];
if (!I18nHandler::getInstance()->isPlainValue('description')) {
- $returnValues = $this->objectAction->getReturnValues();
- $cronjobID = $returnValues['returnValues']->cronjobID;
I18nHandler::getInstance()->save('description', 'wcf.acp.cronjob.description.cronjob'.$cronjobID, 'wcf.acp.cronjob', $this->packageID);
// update group name
- $cronjobEditor = new CronjobEditor($returnValues['returnValues']);
- $cronjobEditor->update([
- 'description' => 'wcf.acp.cronjob.description.cronjob'.$cronjobID
- ]);
+ $data['description'] = 'wcf.acp.cronjob.description.cronjob' . $cronjobID;
}
+ $cronjobEditor = new CronjobEditor($cronjob);
+ $cronjobEditor->update($data);
+
$this->saved();
// reset values