diff options
author | Christian Hesse <mail@eworm.de> | 2021-05-31 10:04:45 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-06-08 21:07:24 +0200 |
commit | 2315d6bc59e6d2294fadb5f0ab8d712f55793db2 (patch) | |
tree | e29bfb61405aa454874ba35f891ba7eab58b8885 | |
parent | 57b0f1b2dd237848f0cdcd19b43b9b0bb16cd15e (diff) |
global-functions: $ScriptInstallUpdate: reload functions just once
-rw-r--r-- | global-functions | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/global-functions b/global-functions index 9f5be02..cf4ad7a 100644 --- a/global-functions +++ b/global-functions @@ -709,6 +709,7 @@ } :local ExpectedConfigVersionBefore $ExpectedConfigVersion; + :local ReloadGlobalFunctions false; :local ScriptInstallUpdateBefore [ :tostr $ScriptInstallUpdate ]; :foreach Script in=[ / system script find where source~"^#!rsc( by RouterOS)\?\n" ] do={ @@ -768,12 +769,7 @@ } } :if ($ScriptVal->"name" ~ "^global-functions(\$|\\.d/.)") do={ - $LogPrintExit2 info $0 ("Reloading global functions.") false; - :do { - / system script run global-functions; - } on-error={ - $LogPrintExit2 error $0 ("Reloading global functions failed!") false; - } + :set ReloadGlobalFunctions true; } } else={ $LogPrintExit2 warning $0 ("Syntax validation for script " . $ScriptVal->"name" . \ @@ -791,6 +787,15 @@ } } + :if ($ReloadGlobalFunctions = true) do={ + $LogPrintExit2 info $0 ("Reloading global functions.") false; + :do { + / system script run global-functions; + } on-error={ + $LogPrintExit2 error $0 ("Reloading global functions failed!") false; + } + } + :if ($ExpectedConfigVersionBefore != $ExpectedConfigVersion) do={ :global GlobalConfigChanges; :global GlobalConfigMigration; |