getid3.install in getID3() 8
Same filename and directory in other branches
Install, update and uninstall functions for the getid3 module.
File
getid3.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the getid3 module.
*/
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Url;
/**
* Implements hook_requirements().
*/
function getid3_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
// Test getID3 version
$requirements['getid3']['title'] = t('getID3()');
if (getid3_load(FALSE)) {
$requirements['getid3']['value'] = SafeMarkup::checkPlain(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::fromRoute('getid3.config'),
));
$requirements['getid3']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}
/**
* Implements hook_install().
*/
function getid3_install() {
// Display a message if it fails to load getID3().
$status = getid3_load();
if ($status == FALSE) {
$path = getid3_get_path();
drupal_set_message(t('The getID3 files <em>getid3.php</em> and <em>write.php</em> could not be found in the %path directory.', array(
'%path' => $path,
)), 'error');
}
// Set module weight for the getID3 module.
module_set_weight('getid3', '-10');
}
Functions
Name | Description |
---|---|
getid3_install | Implements hook_install(). |
getid3_requirements | Implements hook_requirements(). |