summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'backend/functions/execution.php')
-rw-r--r--backend/functions/execution.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/backend/functions/execution.php b/backend/functions/execution.php
index 773e6ee..0aee4d6 100644
--- a/backend/functions/execution.php
+++ b/backend/functions/execution.php
@@ -11,6 +11,18 @@ function task_get_order() {
}
return $order;
}
+function buildlog_entry_get_order() {
+ global $build, $task;
+ static $buildid, $taskorder, $order;
+ if ($buildid === $build->id && $taskorder === $task->order) {
+ $order++;
+ } else {
+ $buildid=$build->id;
+ $taskorder=$task->order;
+ $order=0;
+ }
+ return $order;
+}
function execute_command_with_all($description, $command, $fatal=true, $path=null, $env=null) {
global $build, $task;
if (isset($task))
@@ -64,26 +76,18 @@ function end_internal_task($status=0) {
}
function log_msg($msg, $nl=true) {
global $build, $task;
- static $order, $buildid, $taskorder;
if (!isset($task)) {
start_internal_task($msg);
return;
}
$msg.=$nl?"\n":'';
debug($msg);
- if ($buildid === $build->id && $taskorder === $task->order) {
- $order++;
- } else {
- $buildid=$build->id;
- $taskorder=$task->order;
- $order=0;
- }
- $entry=new sql_buildlog_entry($build->id, $task->order, $order, time(), 'system', $msg);
+ $entry=new sql_buildlog_entry($build->id, $task->order, buildlog_entry_get_order(), time(), 'system', $msg);
$entry->write();
}
function log_status($msg, $cmd) {
start_internal_task($msg);
- $status=is_bool($cmd)?$cmd:eval((strpos($cmd, 'return') === false?'return ':'').$cmd);
+ $status=is_string($cmd)?eval((strpos($cmd, 'return') === false?'return ':'').$cmd):$cmd;
end_internal_task($status?0:1);
debug("... ".($status?color('[success]', 'green'):color('[failure]', 'red')));
return $status;