USER = ".$_GET['USER']);
//echo("
LIB_NAME = ".$_GET['LIB_NAME']);
//echo("
branch = ".$_GET['branch']);
//die("
die");
header("Content-Type: image/svg+xml");
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé
function errorSVG($_name) {
echo('');
exit();
}
include_once("connect.php");
@include_once("connect_server.php");
$COVERAGE_bdd = mysqli_connect($sqlServer, $sqlLogin, $sqlPass, $sqlBDD);
// Check connection
if (mysqli_connect_errno()) {
errorSVG("SQL ERROR");
}
// check if all is here ...
$branch = "master";
$tag = "Linux";
if (isset($_GET['USER']) == FALSE) {
errorSVG("USER??");
}
if (isset($_GET['LIB_NAME']) == FALSE) {
errorSVG("LIB_NAME??");
}
if (isset($_GET['branch']) == TRUE) {
$branch = $_GET['branch'];
}
if (isset($_GET['tag']) == TRUE) {
$tag = $_GET['tag'];
}
//echo "register ".$_POST['JSON_FILE'];
$sql = "SELECT `BUILD_snapshot`.`".$tag."` "
." FROM `BUILD_snapshot`"
." , `CI_group`"
." WHERE `CI_group`.`user-name` = '".$_GET['USER']."'"
." AND `CI_group`.`lib-name` = '".$_GET['LIB_NAME']."'"
." AND `CI_group`.`lib-branch` = '".$branch."'"
." AND `CI_group`.`id` = `BUILD_snapshot`.`id-group`"
." LIMIT 1";
//echo("sql : ".$sql);
$result = $COVERAGE_bdd->query($sql);
//
if ($result == NULL) {
errorSVG("UNKNOW");
}
//echo("find result : ".$result);
if ($result->num_rows > 0) {
if ($result->num_rows > 1) {
errorSVG("To much value");
}
$row = $result->fetch_assoc();
} else {
errorSVG("No Value");
}
$status = $row[$tag];
//some coverage value :
if ($status == "UNKNOW") {
$color = "333";
} else if ($status == "START") {
$color = "11F";
} else if ($status == "ERROR") {
$color = "c11";
} else if ($status == "OK") {
$color = "4c1";
} else {
$color = "FF0";
}
echo('');
// simply close link with the DB...
$COVERAGE_bdd->close();
?>