function mailhandler_requirements in Mailhandler 7.2
Same name and namespace in other branches
- 5 mailhandler.install \mailhandler_requirements()
- 6.2 mailhandler.install \mailhandler_requirements()
- 6 mailhandler.install \mailhandler_requirements()
- 7 mailhandler.install \mailhandler_requirements()
Implements hook_requirements().
Check that a retrieval library exists.
File
- ./
mailhandler.install, line 355 - Install, update and uninstall functions for the Mailhandler module.
Code
function mailhandler_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time.
$t = get_t();
$has_iconv = function_exists('iconv_mime_decode');
$requirements['mailhandler_iconv'] = array(
'title' => $t('Mailhandler iconv'),
'description' => $t("Mailhandler requires that PHP's !ext is enabled in order to function properly.", array(
'!ext' => l('iconv extension', 'http://www.php.net/manual/en/book.iconv.php'),
)),
'value' => $has_iconv ? $t('Enabled') : $t('Not found'),
'severity' => $has_iconv ? REQUIREMENT_OK : REQUIREMENT_ERROR,
);
switch ($phase) {
case 'runtime':
$plugins = mailhandler_get_plugins('mailhandler', 'retrieve');
if (count($plugins) == 1) {
$requirements['mailhandler_retrieve'] = array(
'title' => $t('Mailhandler retrieval plugins'),
'description' => $t('No retrieval plugins are available. Please enable the Mailhandler PHP IMAP module, or another module providing a retrieval plugin.'),
'value' => $t('Not found'),
'severity' => REQUIREMENT_ERROR,
);
}
break;
}
return $requirements;
}