function agenda_requirements in Agenda 7.2
Implements hook_requirements().
File
- ./
agenda.install, line 13 - Install, uninstall and scheme functions for the agenda module.
Code
function agenda_requirements($phase) {
$requirements = array();
$t = get_t();
if ($phase == 'runtime') {
$library = libraries_detect('google-api-php-client');
$error_type = isset($library['error']) ? drupal_ucfirst($library['error']) : '';
$error_message = isset($library['error message']) ? $library['error message'] : '';
if (empty($library['installed'])) {
$requirements['agenda_google_api'] = array(
'title' => $t('Agenda module: Google API Client Library for PHP'),
'value' => $t('@e: At least @a', array(
'@e' => $error_type,
'@a' => AGENDA_MIN_API_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('!error You need to download the !google_api,
extract the archive and place the google-api-php-client directory in
the %path directory on your server.', array(
'!error' => $error_message,
'!google_api' => l($t('Google API PHP Client'), $library['download url']),
'%path' => 'sites/all/libraries',
)),
);
}
elseif (version_compare($library['version'], AGENDA_MIN_API_VERSION, '>=')) {
$requirements['agenda_google_api'] = array(
'title' => $t('Agenda module: Google API Client Library for PHP'),
'severity' => REQUIREMENT_OK,
'value' => $library['version'],
'description' => $t('Read the Agenda module\'s README for additional
steps needed to configure the Google Calendar API.'),
);
}
else {
$requirements['agenda_google_api'] = array(
'title' => $t('Agenda module: Google API Client Library for PHP'),
'value' => $t('At least @a', array(
'@a' => AGENDA_MIN_API_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('You need to download a later version of the
!google_api and replace the old version located in the %path directory
on your server.', array(
'!google_api' => l($t('Google API PHP Client'), $library['download url']),
'%path' => $library['library path'],
)),
);
}
}
return $requirements;
}