Skip to content

Commit 67ced89

Browse files
committed
Fixed a bug when building a folder tree
1 parent 98eaf34 commit 67ced89

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

modules/Orchestrator2022.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,25 @@ public function sync()
842842
}
843843
}
844844

845+
// Update folders PID
846+
847+
foreach($folders as &$folder)
848+
{
849+
//echo $folder['guid']."\r\n";
850+
$folder_pid = 0;
851+
if($this->core->db->select_ex($res, rpv("SELECT f.`id` FROM @runbooks_folders AS f WHERE f.`guid` = ! AND (f.`flags` & ({%RBF_TYPE_SCO2022} | {%RBF_DELETED})) = {%RBF_TYPE_SCO2022} LIMIT 1", $folder['pid'])))
852+
{
853+
$folder_pid = $res[0][0];
854+
}
855+
856+
$folder_id = 0;
857+
if($this->core->db->select_ex($res, rpv("SELECT f.`id` FROM @runbooks_folders AS f WHERE f.`guid` = ! AND (f.`flags` & {%RBF_TYPE_SCO2022}) AND f.`pid` <> # LIMIT 1", $folder['guid'], $folder_pid)))
858+
{
859+
$folder_id = $res[0][0];
860+
$this->core->db->put(rpv("UPDATE @runbooks_folders SET `pid` = # WHERE `id` = # LIMIT 1", $folder_pid, $folder_id));
861+
}
862+
}
863+
845864
unset($folders);
846865

847866
//$activities = $this->retrieve_activities();

0 commit comments

Comments
 (0)