From 83cf2e28381d5eb6666a9ff0c46ac11aa81b4fa5 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 6 Nov 2024 16:10:10 +0800 Subject: [PATCH] * [perf story #69159] Call afterStart method for restart. --- module/task/control.php | 5 ++--- module/task/model.php | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 09504eb87c..2ffdc1e0e0 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -724,9 +724,8 @@ class task extends control $changes = $this->task->start($task, $taskData); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - $action = $this->post->left == 0 ? 'Finished' : 'Restarted'; - $actionID = $this->loadModel('action')->create('task', $taskID, $action, $this->post->comment); - if(!empty($changes)) $this->action->logHistory($actionID, $changes); + $result = $this->task->afterStart($task, $changes, (float)$this->post->left); + if(is_array($result)) $this->send($result); $this->executeHooks($taskID); $response = $this->taskZen->responseAfterChangeStatus($task, $from); diff --git a/module/task/model.php b/module/task/model.php index c419294fa2..0ce31f3407 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -319,7 +319,7 @@ class taskModel extends model * @access public * @return array|bool */ - public function afterStart(object $oldTask, array $changes, float $left, array $output): array|bool + public function afterStart(object $oldTask, array $changes, float $left, array $output = array()): array|bool { /* Update the data of the parent task. */ if($oldTask->parent > 0) $this->computeBeginAndEnd($oldTask->parent);