[Web] Remove logs from docker functions, fix debug syntax
parent
2994b94b6c
commit
c875508687
|
@ -115,7 +115,6 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
|
|||
'fail2ban-mailcow',
|
||||
'clamd-mailcow'
|
||||
);
|
||||
}
|
||||
foreach ($container_array as $container) {
|
||||
$container_stats = docker($container, 'info');
|
||||
?>
|
||||
|
@ -321,7 +320,8 @@ echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
|
|||
<script src="js/debug.js"></script>
|
||||
<?php
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
header('Location: /');
|
||||
exit();
|
||||
}
|
||||
|
|
|
@ -59,33 +59,6 @@ function docker($service_name, $action, $attr1 = null, $attr2 = null, $extra_hea
|
|||
return false;
|
||||
}
|
||||
break;
|
||||
case 'logs':
|
||||
$container_id = docker($service_name, 'get_id');
|
||||
if (ctype_xdigit($container_id)) {
|
||||
$lines = (empty($attr1) || !is_numeric($attr1)) ? 100 : $attr1;
|
||||
curl_setopt($curl, CURLOPT_URL, 'http://dockerapi:8080/containers/' . $container_id . '/logs/' . $lines);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 0);
|
||||
$response = curl_exec($curl);
|
||||
if ($response === false) {
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
return $err;
|
||||
}
|
||||
else {
|
||||
curl_close($curl);
|
||||
if (empty($response)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return json_decode($response, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'post':
|
||||
if (!empty($attr1)) {
|
||||
$container_id = docker($service_name, 'get_id');
|
||||
|
|
Loading…
Reference in New Issue