function video_requirements in Video 7.2
Same name and namespace in other branches
- 6.5 video.install \video_requirements()
- 6.4 video.install \video_requirements()
Implements hook_requirements().
File
- ./
video.install, line 255 - Provides installation schema for video.module @author Heshan Wanigasooriya <heshan@heidisoft.com>
Code
function video_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$transcoder = new Transcoder();
$errormsg = '';
if (!$transcoder
->hasTranscoder()) {
$name = t('None');
$version = t('None');
$available = TRUE;
}
else {
$name = $transcoder
->getTranscoder()
->getName();
$version = $transcoder
->getTranscoder()
->getVersion();
$available = $transcoder
->getTranscoder()
->isAvailable($errormsg);
}
$requirements['video'] = array(
'title' => t('Video transcoder: @transcoder', array(
'@transcoder' => $name,
)),
'value' => NULL,
);
if (!$version) {
$requirements['video']['description'] = t('Missing the transcoder library. Please <a href="@url">install FFmpeg</a> in to your server if you intend to transcode or to auto create thumbnails.', array(
'@url' => url('http://video.heidisoft.com/documentation/ffmpeg-installtion-scripts'),
));
$requirements['video']['severity'] = REQUIREMENT_ERROR;
}
elseif (!$available) {
$requirements['video']['description'] = t('The selected transcoder can\'t be used: !reason. Select <a href="@transcoder-url">another transcoder</a> or resolve the problem.', array(
'!reason' => rtrim($errormsg, '.'),
'@transcoder-url' => url('admin/config/media/video/transcoders'),
));
$requirements['video']['severity'] = REQUIREMENT_ERROR;
}
else {
$requirements['video']['value'] = $version;
$requirements['video']['severity'] = REQUIREMENT_OK;
}
// Check if URL wrappers are present when allow_url_fopen is off
// Also see http://drupal.org/node/1521224
if (!ini_get('allow_url_fopen')) {
$wrappers = module_invoke_all('stream_wrappers');
$remotes = array();
foreach ($wrappers as $wrapper) {
if (empty($wrapper['type']) || ($wrapper['type'] & STREAM_WRAPPERS_LOCAL) == 0) {
$remotes[] = $wrapper['name'];
}
}
// $remotes contains all remote stream wrappers
if (!empty($remotes)) {
$requirements['php_allow_url_fopen'] = array(
'title' => t('PHP remote stream wrappers'),
'value' => t('Not supported'),
'severity' => REQUIREMENT_WARNING,
'description' => t('Your PHP configuration disallows remote stream wrappers. Change the php.ini setting <em>allow_url_fopen</em> to <em>On</em> to use the following locations for storing files:') . theme('item_list', array(
'items' => $remotes,
)),
);
}
}
}
return $requirements;
}