function rrssb_requirements in Ridiculously Responsive Social Sharing Buttons 7
Same name and namespace in other branches
- 8.2 rrssb.install \rrssb_requirements()
- 7.2 rrssb.module \rrssb_requirements()
Implements hook_requirements().
File
- ./
rrssb.module, line 348
Code
function rrssb_requirements($phase) {
// Check for library version. We do a runtime check only, as we don't want to block install - the normal sequence
// is to install the module and then use the drush command to get the library.
$requirements = array();
if ($phase == 'runtime') {
$requirements['rrssb']['title'] = t('RRSSB library');
$library = libraries_detect('rrssb');
if (!$library['installed']) {
$requirements['rrssb']['value'] = t('Not installed');
$requirements['rrssb']['severity'] = REQUIREMENT_ERROR;
$requirements['rrssb']['description'] = '';
}
else {
$requirements['rrssb']['value'] = $library['version'];
$compare = version_compare($library['version'], RRSSB_LIBRARY_VERSION);
if ($compare < 0) {
$requirements['rrssb']['severity'] = REQUIREMENT_ERROR;
$requirements['rrssb']['description'] = t('Library version is too old. ');
}
else {
if ($compare > 0) {
$requirements['rrssb']['severity'] = REQUIREMENT_WARNING;
$requirements['rrssb']['description'] = t('Library version is newer than has been tested. ');
}
else {
$requirements['rrssb']['severity'] = REQUIREMENT_OK;
}
}
}
if ($requirements['rrssb']['severity'] != REQUIREMENT_OK) {
$requirements['rrssb']['description'] .= t('Please download the RRSSB library using "drush rrssb-plugin" or from !link.', array(
'!link' => l(RRSSB_LIBRARY_URI, RRSSB_LIBRARY_URI),
));
}
}
return $requirements;
}