diff options
-rw-r--r-- | lib.php | 17 | ||||
-rw-r--r-- | test_index.php | 10 |
2 files changed, 18 insertions, 9 deletions
@@ -170,3 +170,20 @@ function publish_stats_headers($stats, $last_package = null) round($buildtime_total / $build_count, 2); header(sprintf('X-BS-Buildtime-Average: %5.2f', $buildtime_avg)); } + +/** + * check if emi is running + * + * @return +*/ +function get_upload_time() +{ + if (file_exists('/var/lib/schedbot/tmp/upload')) { + $stat = stat('/var/lib/schedbot/tmp/upload'); + if ($stat) { + return $stat['mtime']; + } + } + + return null; +} diff --git a/test_index.php b/test_index.php index fa83a4e..2382330 100644 --- a/test_index.php +++ b/test_index.php @@ -170,15 +170,7 @@ if ($total > 0) { } } -// check if emi is running -$upload_time = null; -$stat = null; -if (file_exists('/var/lib/schedbot/tmp/upload')) { - $stat = stat('/var/lib/schedbot/tmp/upload'); - if ($stat) { - $upload_time = $stat['mtime']; - } -} +$upload_time = get_upload_time(); $last_pkg = ($_GET['last'] && $total > 0) ? reset($pkgs) : null publish_stats_headers($stats, $last_pkg); |