summaryrefslogtreecommitdiffstats
path: root/inc/trigger.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2021-04-20 17:09:48 +0200
committerSimon Rettberg2021-04-20 17:09:48 +0200
commite6b2d50114f497281f3db83374755fa15fe0d016 (patch)
treed6def2c052f44117bf958298a6dc6404b35e4051 /inc/trigger.inc.php
parent[serversetup-bwlp-ipxe] Add iPXE version selector (diff)
downloadslx-admin-e6b2d50114f497281f3db83374755fa15fe0d016.tar.gz
slx-admin-e6b2d50114f497281f3db83374755fa15fe0d016.tar.xz
slx-admin-e6b2d50114f497281f3db83374755fa15fe0d016.zip
[inc/Trigger] Remember ::ipxe() result and return it on subsequent calls
This fixes triggering two or more compile runs in one request, which is most likely pointless as it would generate the same result. Just remember the return value (task id) from the first onvication and return it right away.
Diffstat (limited to 'inc/trigger.inc.php')
-rw-r--r--inc/trigger.inc.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/inc/trigger.inc.php b/inc/trigger.inc.php
index cd38ce98..6acd6f87 100644
--- a/inc/trigger.inc.php
+++ b/inc/trigger.inc.php
@@ -19,6 +19,9 @@ class Trigger
*/
public static function ipxe($taskId = null)
{
+ static $lastResult = false;
+ if ($lastResult !== false)
+ return $lastResult;
$hooks = Hook::load('ipxe-update');
foreach ($hooks as $hook) {
$ret = function($taskId) use ($hook) {
@@ -34,7 +37,7 @@ class Trigger
$taskId = $ret['id'];
}
}
- return $taskId ?? false;
+ return $lastResult = ($taskId ?? false);
}
/**