From 5d35813fbb563f509c1b919953d2ae32ce7e88da Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 12 Dec 2024 09:31:00 +0800 Subject: [PATCH] * [misc] adjust backup cron delete for instance. --- module/instance/model.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/module/instance/model.php b/module/instance/model.php index b1f282d139..cbcf558e94 100644 --- a/module/instance/model.php +++ b/module/instance/model.php @@ -1381,8 +1381,8 @@ class instanceModel extends model } /** - * Delete backup. * 删除备份。 + * Delete backup. * @param object $instance * @param string $backupName * @access public @@ -1394,15 +1394,16 @@ class instanceModel extends model } /** - * Delete Backup Cron. * 删除备份任务. - * @param $instance - * @return void + * Delete Backup Cron. + * @param object $instance + * @return bool */ - public function deleteBackupCron($instance) + public function deleteBackupCron(object $instance): bool { $command = 'moduleName=instance&methodName=cronBackup&instanceID=' . $instance->id; - $cron = $this->dao->select('*')->from(TABLE_CRON)->where('command')->eq($command)->fetch(); - if($cron->id) $this->dao->delete()->from(TABLE_CRON)->where('id')->eq($cron->id)->exec(); + $this->dao->delete()->from(TABLE_CRON)->where('command')->eq($command)->exec(); + + return !dao::isError(); } }