Some bugfixes

This commit is contained in:
Jeroen De Meerleer 2018-09-07 13:55:46 +02:00
parent e107ff2967
commit 4cd7bb9112
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 4 additions and 7 deletions

View File

@ -3,7 +3,7 @@
/* /*
* The MIT License * The MIT License
* *
* Copyright 2017 Jeroen De Meerleer <me@jeroened.be>. * Copyright 2017-2018 Jeroen De Meerleer <me@jeroened.be>.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -34,9 +34,9 @@ if ($jobnameResult[0]["user"] != $_SESSION["userID"]) {
exit; exit;
} }
$jobName = $jobnameResult[0]['name']; $jobName = $jobnameResult[0]['name'];
$rebootjob = $jobnameResult[0]['name'] ? true : false; $rebootjob = $jobnameResult[0]['url'] == 'reboot' ? true : false;
$runsForJobQry = "SELECT runs.*, FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?"; $runsForJobQry = "SELECT runs.*, jobs.jobID FROM runs, jobs WHERE runs.job = jobs.jobID AND runs.job = ?";
$allruns = true; $allruns = true;
if(!(isset($_GET['allruns']) && $_GET['allruns'] == 1)) { if(!(isset($_GET['allruns']) && $_GET['allruns'] == 1)) {
$runsForJobQry .= " AND runs.statuscode <> jobs.expected"; $runsForJobQry .= " AND runs.statuscode <> jobs.expected";
@ -49,9 +49,6 @@ $runsForJobResult = $runsForJob->fetchAll(PDO::FETCH_ASSOC);
$loader = new Twig_Loader_Filesystem('templates'); $loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array('cache' => 'cache', "debug" => true)); $twig = new Twig_Environment($loader, array('cache' => 'cache', "debug" => true));
//var_dump($alljobsResult);
//exit;
$runsForJobRendered = array();$count = 0; $runsForJobRendered = array();$count = 0;
foreach($runsForJobResult as $key=>$value) { foreach($runsForJobResult as $key=>$value) {
$runsForJobRendered[$count]["runID"] = $value["runID"]; $runsForJobRendered[$count]["runID"] = $value["runID"];

View File

@ -46,7 +46,7 @@ if (file_exists("cache/get-services.trigger")) {
$services = implode("\n", $services); $services = implode("\n", $services);
$stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)"); $stmt = $db->prepare("INSERT INTO runs(job, statuscode, result, timestamp) VALUES(?, ?, ?, ?)");
$stmt->execute(array($job['jobID'], '1', $services, time())); $stmt->execute(array($job['jobID'], '0', $services, time()));
} }
unlink("cache/get-services.trigger"); unlink("cache/get-services.trigger");
unlink("cache/reboot-time.trigger"); unlink("cache/reboot-time.trigger");