From 1ac3124072a9f1b4c2c0a89abe091e62d2dd6f81 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 18 Jul 2024 15:18:28 +0200 Subject: [sysconfig] Don't delete config module on edit if taskmanager fails --- modules-available/sysconfig/addconfig.inc.php | 4 ++-- modules-available/sysconfig/inc/configtgz.inc.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'modules-available') diff --git a/modules-available/sysconfig/addconfig.inc.php b/modules-available/sysconfig/addconfig.inc.php index 27af31e8..456ee989 100644 --- a/modules-available/sysconfig/addconfig.inc.php +++ b/modules-available/sysconfig/addconfig.inc.php @@ -29,7 +29,7 @@ abstract class AddConfig_Base if (($editId = Request::any('edit', 0, 'int')) !== 0) { self::$instance->edit = ConfigTgz::get($editId); if (self::$instance->edit === null) - ErrorHandler::traceError('Invalid config id for editing'); + ErrorHandler::traceError('Invalid config id for editing: ' . $editId); Util::addRedirectParam('edit', self::$instance->edit->id()); } } @@ -182,7 +182,7 @@ class AddConfig_Finish extends AddConfig_Base $this->edit->update($title, $modules); $this->config = $this->edit; } - if ($this->config->generate(true, 150) === false) { + if ($this->config->generate($this->edit === null, 150) === false) { Message::addError('unsuccessful-action'); Util::redirect('?do=SysConfig&action=addconfig'); } diff --git a/modules-available/sysconfig/inc/configtgz.inc.php b/modules-available/sysconfig/inc/configtgz.inc.php index 8ac87908..a54aaef9 100644 --- a/modules-available/sysconfig/inc/configtgz.inc.php +++ b/modules-available/sysconfig/inc/configtgz.inc.php @@ -123,10 +123,11 @@ class ConfigTgz if (!is_array($task) || !isset($task['id']) || Taskmanager::isFailed($task)) { // Failed... Taskmanager::addErrorMessage($task); - if (!$deleteOnError) + if (!$deleteOnError) { $this->markFailed(); - else + } else { $this->delete(); + } return false; } // Still running, add callback @@ -324,9 +325,8 @@ class ConfigTgz public static function get(int $configId): ?ConfigTgz { - $ret = Database::queryFirst("SELECT configid, title, filepath FROM configtgz WHERE configid = :configid", array( - 'configid' => $configId - )); + $ret = Database::queryFirst("SELECT configid, title, filepath FROM configtgz WHERE configid = :configid", + ['configid' => $configId]); if ($ret === false) return null; return self::instanceFromRow($ret); -- cgit v1.2.3-55-g7522