|
1 | 1 | <?php |
2 | 2 |
|
| 3 | +/** |
| 4 | + * Implements hook_requirements(). |
| 5 | + */ |
| 6 | +function alma_requirements($phase) { |
| 7 | + $requirements = array(); |
| 8 | + // Ensure translations don't break at install time. |
| 9 | + $t = get_t(); |
| 10 | + |
| 11 | + if (!function_exists('simplexml_load_string')) { |
| 12 | + $requirements['simplexml'] = array( |
| 13 | + 'title' => 'SimpleXML', |
| 14 | + 'description' => $t('The Alma module requires SimpleXML to function. Please install and/or enable SimpleXML in your PHP configuration.'), |
| 15 | + 'severity' => REQUIREMENT_ERROR, |
| 16 | + ); |
| 17 | + } |
| 18 | + |
| 19 | + if ($phase == 'runtime') { |
| 20 | + $requirements['alma'] = array( |
| 21 | + 'title' => $t('Alma'), |
| 22 | + 'value' => $t('Alma configured'), |
| 23 | + 'severity' => REQUIREMENT_OK, |
| 24 | + ); |
| 25 | + if (!variable_get('alma_base_url', FALSE) || !variable_get('ting_agency', FALSE)) { |
| 26 | + $requirements['alma']['value'] = $t('Alma not configured'); |
| 27 | + $requirements['alma']['description'] = $t('Alma is not properly configured, please visit <a href="@link">the settings page</a>.', array('@link' => url('admin/config/ding/provider/alma'))); |
| 28 | + $requirements['alma']['severity'] = REQUIREMENT_ERROR; |
| 29 | + } |
| 30 | + $requirements['alma_wayf'] = array( |
| 31 | + 'title' => $t('Alma WAYF'), |
| 32 | + 'value' => $t('Alma WAYF configured'), |
| 33 | + 'severity' => REQUIREMENT_OK, |
| 34 | + ); |
| 35 | + if (!variable_get('wayf_hash', FALSE)) { |
| 36 | + $requirements['alma']['value'] = $t('Alma WAYF not configured'); |
| 37 | + $requirements['alma']['description'] = $t('Alma WAYF is not properly configured, you need to set $conf[\'wayf_hash\'] in setttings.php.'); |
| 38 | + $requirements['alma']['severity'] = REQUIREMENT_ERROR; |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + return $requirements; |
| 43 | +} |
3 | 44 |
|
4 | 45 | /** |
5 | 46 | * Update system table set alma weight=10 to ensure form_alter hooks are called |
@@ -32,7 +73,7 @@ function alma_update_7002() { |
32 | 73 | function alma_update_7003() { |
33 | 74 | return db_update('field_config') |
34 | 75 | ->fields(array( |
35 | | - 'type' => 'datetime' |
| 76 | + 'type' => 'datetime', |
36 | 77 | )) |
37 | 78 | ->condition('field_name', 'field_alma_reservation_pause', '=') |
38 | 79 | ->execute(); |
|
0 commit comments