You are here

function getid3_requirements in getID3() 7.2

Same name and namespace in other branches
  1. 8 getid3.install \getid3_requirements()
  2. 5 getid3.module \getid3_requirements()
  3. 6 getid3.install \getid3_requirements()
  4. 7 getid3.install \getid3_requirements()

Implements hook_requirements().

File

./getid3.install, line 10
Install, update and uninstall functions for the getid3 module.

Code

function getid3_requirements($phase) {
  $t = get_t();
  $requirements = array();
  if ($phase == 'runtime') {
    $requirements['getID3'] = array(
      'title' => $t('getID3() PHP Library'),
      'value' => $t('The getID3() library is present'),
      'severity' => REQUIREMENT_ERROR,
    );

    // Detect the library
    if (module_exists('libraries')) {
      $library = libraries_detect('getid3');
      if ($library['installed']) {
        $requirements['getID3']['severity'] = REQUIREMENT_OK;
      }
      elseif (isset($library['error']) && !empty($library['error'])) {
        $requirements['getID3']['description'] = $library['error message'];
      }
    }
    else {
      $requirements['getID3']['description'] = t('The getID3() module now requires Libraries.');
    }
  }
  return $requirements;
}