function mailchimp_requirements in Mailchimp 7.5
Same name and namespace in other branches
- 8 mailchimp.install \mailchimp_requirements()
- 7.2 mailchimp.install \mailchimp_requirements()
- 7.3 mailchimp.install \mailchimp_requirements()
- 7.4 mailchimp.install \mailchimp_requirements()
- 2.x mailchimp.install \mailchimp_requirements()
Implements hook_requirements().
File
- ./
mailchimp.install, line 21 - Install, update and uninstall functions for the mailchimp module.
Code
function mailchimp_requirements($phase) {
$requirements = array();
// Ensure translations don't break at install time:
$t = get_t();
// Report Drupal version:
if (in_array($phase, array(
'runtime',
'update',
))) {
// Check to see if Libraries module is being used.
if (module_exists('libraries')) {
$library = libraries_detect('mailchimp');
}
else {
$library = FALSE;
}
$requirements['mailchimp'] = array(
'title' => $t('MailChimp'),
);
if ($library['installed']) {
$requirements['mailchimp'] += array(
'value' => $library['version'],
'description' => $t('The MailChimp MCAPI wrapper library is installed correctly.'),
'severity' => REQUIREMENT_OK,
);
}
elseif (class_exists('Mailchimp\\Mailchimp')) {
$requirements['mailchimp'] += array(
'value' => Mailchimp\Mailchimp::VERSION,
'description' => $t('The MailChimp MCAPI wrapper library is installed correctly.'),
'severity' => REQUIREMENT_OK,
);
}
else {
$requirements['mailchimp'] += array(
'value' => $library['error'],
'description' => $library['error message'],
'severity' => REQUIREMENT_ERROR,
);
}
// Notify user to update MailChimp library if using version 1.0.7 or lower.
if (empty($library['error'])) {
$version_int = (int) str_replace('.', '', $library['version']);
if ($version_int <= 107) {
$requirements['mailchimp']['value'] = $library['version'];
$requirements['mailchimp']['description'] = $t('Please update the <a href="https://github.com/thinkshout/mailchimp-api-php/releases">MailChimp library</a> to at least version 1.0.8 to ensure continued stability.');
$requirements['mailchimp']['severity'] = REQUIREMENT_WARNING;
}
}
}
return $requirements;
}