-
Notifications
You must be signed in to change notification settings - Fork 1
/
php_ffmpeg.install
34 lines (33 loc) · 1.55 KB
/
php_ffmpeg.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @file
* Install, update, and uninstall functions for the PHP-FFMpeg module.
*/
/**
* Implements hook_requirements().
*/
function php_ffmpeg_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$requirements['php-ffmpeg'] = array(
'title' => 'PHP-FFMPeg',
'severity' => REQUIREMENT_ERROR,
);
$library = libraries_detect('php-ffmpeg');
if ($library && $library['installed']) {
$requirements['php-ffmpeg']['value'] = $library['version'];
try {
$version = explode("\n", php_ffmpeg()->getFFMpegDriver()->command('-version'));
$requirements['php-ffmpeg']['value'] .= " (using {$version[0]})";
$requirements['php-ffmpeg']['severity'] = REQUIREMENT_OK;
}
catch (\FFMpeg\Exception\ExecutableNotFoundException $e) {
$requirements['php-ffmpeg']['description'] = t('This library requires a working FFMpeg install. You will need both FFMpeg and FFProbe binaries to use it. Be sure that these binaries can be located with system PATH to get the benefit of the binary detection, otherwise you should have to explicitly give the binaries path on the <a href="@admin">configuration page</a>.', array('@admin' => url('admin/config/development/php-ffmpeg')));
}
}
else {
$requirements['php-ffmpeg']['description'] = t('The PHP-FFMpeg library is not installed. Please check package status on the <a href="@admin">Composer Manager packages status page</a>.', array('@admin' => url('admin/config/system/composer-manager')));
}
}
return $requirements;
}