function mailchimp_requirements in Mailchimp 7.2
Same name and namespace in other branches
- 8 mailchimp.install \mailchimp_requirements()
- 7.5 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 22 - 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();
if ($phase == 'update') {
$path = drupal_get_path('module', 'libraries') . '/libraries.info';
$info = drupal_parse_info_file($path);
if (version_compare($info['version'], '7.x-2.0', '<')) {
$requirements['mailchimp'] = array(
'title' => $t('Mailchimp'),
'value' => '7.x-2.x',
'description' => $t('libraries 2.x is required for MailChimp 7.x-2.8 or higher.'),
'severity' => REQUIREMENT_ERROR,
);
return $requirements;
}
}
// Report Drupal version:
if (in_array($phase, array(
'runtime',
'update',
))) {
$library = libraries_detect('mailchimp');
$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,
);
}
else {
$requirements['mailchimp'] += array(
'value' => $library['error'],
'description' => $library['error message'],
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}