Skip to content

Commit d875475

Browse files
committed
Exporting environment variables (no values)
1 parent a94d598 commit d875475

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

‎ProcessMaker/Jobs/ExportProcess.php‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Cache;
66
use Illuminate\Bus\Queueable;
7+
use ProcessMaker\Models\EnvironmentVariable;
78
use ProcessMaker\Models\Process;
89
use ProcessMaker\Models\Screen;
910
use ProcessMaker\Models\Script;
@@ -78,10 +79,27 @@ private function packageScripts()
7879

7980
private function packageAssignmentTypes()
8081
{
81-
$this->package['assignments'] = [];
8282
$bpmn = $this->package['process']['bpmn'];
83-
$doesMatch = preg_replace('/(pm:assignedUsers="\d+")/', '', $bpmn);
84-
83+
84+
$bpmn = preg_replace('/(pm:assignedUsers="\d+")/', '', $bpmn);
85+
$bpmn = preg_replace('/(pm:assignedGroups="\d+")/', '', $bpmn);
86+
87+
$this->package['process']['bpmn'] = $bpmn;
88+
}
89+
90+
private function packageEnvironmentVariables()
91+
{
92+
$this->package['environment_variables'] = [];
93+
$environmentVariables = EnvironmentVariable::get();
94+
95+
foreach ($environmentVariables as $environmentVariable) {
96+
foreach ($this->package['scripts'] as $script) {
97+
$position = strpos($script['code'], $environmentVariable->name);
98+
if ($position !== false) {
99+
$this->package['environment_variables'][] = $environmentVariable->toArray();
100+
}
101+
}
102+
}
85103
}
86104

87105
private function packageFile()
@@ -93,6 +111,7 @@ private function packageFile()
93111
$this->packageScreens();
94112
$this->packageScripts();
95113
$this->packageAssignmentTypes();
114+
$this->packageEnvironmentVariables();
96115
}
97116

98117
private function encodeFile()

0 commit comments

Comments
 (0)