$t('Munin plugin modules'),
'value' => $t('No plugin found'),
'description' => $t('Munin API is enabled, but does not find any plugin, including the one built into the API.'),
'severity' => REQUIREMENT_ERROR,
];
break;
case 1:
$req = [
'title' => $t('Munin plugin modules'),
'value' => $t('No Munin plugin module enabled beyond API'),
'description' => $t('Munin API is enabled, but no plugin module is enabled to report to it except the one built within the API. You should either enable some plugin modules or disable and uninstall Munin API.', [
'!link' => url('admin/modules'),
]),
'severity' => REQUIREMENT_INFO,
];
break;
default:
$req = [
'title' => $t('Munin plugin modules'),
// Format plural although $count >= 2 because some languages have
// several plural forms.
'value' => format_plural($count, '1 Munin plugin enabled.',
'@count Munin plugins enabled.', [
'!link' => url(Munin::R_REPORTS),
]
),
'severity' => REQUIREMENT_OK,
];
}
$ret[] = $req;
}
elseif ($phase != 'install') {
// This should never happen and points to a severe error somewhere.
watchdog(Munin::MODULE, 'Invalid phase %phase passed to %function', [
'%phase' => $phase,
'%function' => __FUNCTION__,
], WATCHDOG_ERROR);
}
/* else $phase == 'install', nothing to do. */
return $ret;
}
/**
* Implements hook_install().
*/
function munin_api_install() {
variable_set(Munin::V_INIT_PATH, Munin::D_INIT_PATH);
variable_set(Munin::V_LAST, 0);
// Ensure reporting is indeed opt-in, forcing default to off.
variable_set(Munin::V_NEXT_REPORT, 0);
variable_set(Munin::V_WATCHDOG, Munin::D_WATCHDOG);
}
/**
* Implements hook_uninstall().
*/
function munin_api_uninstall() {
$vars = [
Munin::V_INIT_PATH,
Munin::V_LAST,
Munin::V_NEXT_REPORT,
Munin::V_WATCHDOG,
];
foreach ($vars as $var) {
variable_del($var);
}
}