[Web] Remove logs from docker functions, fix debug syntax

master
andre.peters 2017-12-11 09:43:43 +01:00
parent 2994b94b6c
commit c875508687
2 changed files with 2 additions and 29 deletions

View File

@ -115,7 +115,6 @@ $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
'fail2ban-mailcow', 'fail2ban-mailcow',
'clamd-mailcow' 'clamd-mailcow'
); );
}
foreach ($container_array as $container) { foreach ($container_array as $container) {
$container_stats = docker($container, 'info'); $container_stats = docker($container, 'info');
?> ?>
@ -321,7 +320,8 @@ echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n";
<script src="js/debug.js"></script> <script src="js/debug.js"></script>
<?php <?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';
} else { }
else {
header('Location: /'); header('Location: /');
exit(); exit();
} }

View File

@ -59,33 +59,6 @@ function docker($service_name, $action, $attr1 = null, $attr2 = null, $extra_hea
return false; return false;
} }
break; 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': case 'post':
if (!empty($attr1)) { if (!empty($attr1)) {
$container_id = docker($service_name, 'get_id'); $container_id = docker($service_name, 'get_id');