date_ical.install 1.28 KB
Newer Older
Karen Stevenson's avatar
Karen Stevenson committed
1
2
3
4
5
6
7
<?php

/**
 * @file
 * Install, update and uninstall functions for the date_ical module.
 *
 */
Robert Rollins's avatar
Robert Rollins committed
8
9
10
11
12
/**
 * Implements hook_requirements().
 */
function date_ical_requirements($phase) {
  $requirements = array();
13
  
14
  // Ensure translations don't break at install time.
Robert Rollins's avatar
Robert Rollins committed
15
  $t = get_t();
16
  
Robert Rollins's avatar
Robert Rollins committed
17
18
19
20
21
22
23
24
25
26
27
28
  switch ($phase) {
    case 'runtime':
      if (($library = libraries_detect('iCalcreator')) && !empty($library['installed'])) {
        $requirements['date_ical'] = array(
          'title' => $t('Date iCal'),
          'value' => $t('iCalcreator library is installed, version: @version found', array('@version' => $library['version'])),
          'severity' => REQUIREMENT_OK,
        );
      }
      else {
        $requirements['date_ical'] = array(
          'title' => $t('Date iCal'),
29
          'value' => $t('iCalcreator library could not be found, check the installation instructions for the Date iCal module.'),
Robert Rollins's avatar
Robert Rollins committed
30
31
32
33
34
35
          'description' => $t('The error message was: @error<br>!error_message', array('@error' => $library['error'], '!error_message' => $library['error message'])),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      break;
  }
36
  
Robert Rollins's avatar
Robert Rollins committed
37
38
39
40
41
42
43
44
45
  return $requirements;
}

/**
 * Implementation of hook_enable().
 */
function date_ical_enable() {
  cache_clear_all('plugins:feeds:plugins', 'cache');
}