summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'backend/functions/execution.php')
-rw-r--r--backend/functions/execution.php38
1 files changed, 11 insertions, 27 deletions
diff --git a/backend/functions/execution.php b/backend/functions/execution.php
index f35e8c9..fbdb72f 100644
--- a/backend/functions/execution.php
+++ b/backend/functions/execution.php
@@ -1,28 +1,4 @@
<?php
-function task_get_order() {
- global $build;
- static $buildid=null;
- static $order=null;
- if ($build->id === $buildid) {
- $order++;
- } else {
- $buildid=$build->id;
- $order=0;
- }
- 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))
@@ -80,6 +56,7 @@ function log_msg($msg, $nl=true) {
global $build, $task;
if (!isset($task)) {
start_internal_task($msg);
+ debug('log_msg creating task... this is bad');
return;
}
$msg.=$nl?"\n":'';
@@ -88,10 +65,17 @@ function log_msg($msg, $nl=true) {
$entry->write();
}
function log_status($msg, $cmd) {
- start_internal_task($msg);
+ global $task;
+ if ($istask=!isset($task)) {
+ start_internal_task($msg);
+ } else {
+ log_msg($msg, false);
+ }
$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')));
+ if ($istask)
+ end_internal_task($status?0:1);
+ else
+ log_msg("... ".($status?color('[success]', 'green'):color('[failure]', 'red')));
return $status;
}
?>