You are here

function getid3_requirements in getID3() 7

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.2 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') {

    // Test getID3 version
    $requirements['getid3']['title'] = $t('getID3()');
    if (getid3_load(FALSE)) {
      $requirements['getid3']['value'] = check_plain(getid3_get_version());

      // Check if demos directory exists.
      $getid3_demos_path = getid3_get_path() . '/../demos';
      if (file_exists($getid3_demos_path)) {
        $requirements['getid3']['description'] = $t("Your getID3 library is insecure! The demos distributed with getID3 contains code which creates a huge security hole. Remove the demos directory (%path) from beneath Drupal's directory.", array(
          '%path' => realpath($getid3_demos_path),
        ));
        $requirements['getid3']['severity'] = REQUIREMENT_ERROR;
      }
    }
    else {
      $requirements['getid3']['value'] = $t('Not found or wrong version');
      $requirements['getid3']['description'] = $t('You must install <a href="@getid3">getID3()</a> to %getid3dir, or <a href="@getid3settings">configure its installation path</a>.', array(
        '@getid3' => 'http://www.getid3.org',
        '%getid3dir' => 'sites/all/libraries/getid3',
        '@getid3settings' => url('admin/config/media/getid3'),
      ));
      $requirements['getid3']['severity'] = REQUIREMENT_ERROR;
    }
  }
  return $requirements;
}