chg: [workflow] Enable some module by default when updating

pull/8530/head
Sami Mokaddem 2022-07-26 11:16:08 +02:00
parent acbf0238d0
commit 5e29f975d1
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 12 additions and 0 deletions

View File

@ -227,6 +227,10 @@ class AppModel extends Model
case 48:
$dbUpdateSuccess = $this->__generateCorrelations();
break;
case 87:
$this->Workflow = Classregistry::init('Workflow');
$this->Workflow->enableDefaultModules();
break;
default:
$dbUpdateSuccess = $this->updateDatabase($command);
break;

View File

@ -56,6 +56,8 @@ class Workflow extends AppModel
]
];
/** @var WorkflowGraphTool */
public $workflowGraphTool;
public $defaultContain = [
];
@ -64,6 +66,7 @@ class Workflow extends AppModel
private $error_while_loading = [];
private $module_initialized = false;
private $modules_enabled_by_default = ['generic-if', 'distribution-if', 'published-if', 'organisation-if', 'tag-if', 'concurrent-task', 'stop-execution', 'webhook', 'push-zmq'];
const CAPTURE_FIELDS_EDIT = ['name', 'description', 'timestamp', 'data'];
const CAPTURE_FIELDS_ADD = ['uuid', 'name', 'description', 'timestamp', 'data', 'trigger_id'];
@ -144,6 +147,11 @@ class Workflow extends AppModel
$this->updateListeningTriggers($this->workflowToDelete);
}
public function enableDefaultModules()
{
$this->toggleModules($this->modules_enabled_by_default, true, false);
}
protected function checkTriggerEnabled($trigger_id)
{
$settingName = sprintf('Plugin.Workflow_triggers_%s', $trigger_id);