function theme_varnish_status in Varnish 7
Same name and namespace in other branches
- 6 varnish.module \theme_varnish_status()
Theme handler for theme('varnish_status').
1 theme call to theme_varnish_status()
- varnish_admin_settings_form in ./
varnish.admin.inc - Menu callback for varnish admin settings.
File
- ./
varnish.module, line 267 - Common functions used for the module.
Code
function theme_varnish_status($variables) {
$items = array();
$status = $variables['status'];
foreach ($status as $terminal => $state) {
list($server, $port) = explode(':', $terminal);
if ($state == VARNISH_SERVER_STATUS_UP) {
$icon = theme('image', array(
'path' => 'misc/watchdog-ok.png',
'alt' => t("Server OK: @server:@port", array(
'@server' => $server,
'@port' => $port,
)),
'title' => "{$server}:{$port}",
));
$version = $variables['version'];
if ($version < 3) {
$items[] = t('!status_icon Varnish running. Observe more detailed statistics !link.', array(
'!status_icon' => $icon,
'!link' => l(t('here'), 'admin/reports/varnish'),
));
}
else {
$items[] = t('!status_icon Varnish running.', array(
'!status_icon' => $icon,
));
}
}
else {
$icon = theme('image', array(
'path' => 'misc/watchdog-error.png',
'alt' => t("Server down: @server:@port", array(
'@server' => $server,
'@port' => $port,
)),
'title' => "{$server}:{$port}",
));
$items[] = t('!status_icon The Varnish control terminal is not responding at @server on port @port.', array(
'!status_icon' => $icon,
'@server' => $server,
'@port' => $port,
));
}
}
return theme('item_list', array(
'items' => $items,
));
}