private function video_localcommand::run_command in Video 6.5
Run the specified command
The nice prefix is automatically added. The command is logged if the settings specify that all commands should be logged. The command and error are logged if the command results in an error
Parameters
string $command:
string $output Output of the command:
string $purpose Purpose of the command. This is logged.:
bool $ignoreoutputfilenotfound Whether to the output file not found error. Useful for input file information.:
3 calls to video_localcommand::run_command()
- video_localcommand::convert_video in transcoders/
video_localcommand.inc - Convert the given video.
- video_localcommand::generate_thumbnails in transcoders/
video_localcommand.inc - video_localcommand::get_video_info in transcoders/
video_localcommand.inc - Get some information from the video file
File
- transcoders/
video_localcommand.inc, line 41
Class
Code
private function run_command($command, &$output, $purpose = NULL, $ignoreoutputfilenotfound = FALSE) {
$output = '';
$command = $command . ' 2>&1';
if ($this->usenice) {
$command = 'nice -n 19 ' . $command;
}
$purposetext = !empty($purpose) ? ' ' . t('for') . ' ' . $purpose : '';
if ($this->logcommands) {
watchdog('video_command', 'Executing command!purposetext: <pre>@command</pre>', array(
'@command' => $command,
'!purposetext' => !empty($purpose) ? ' for ' . $purpose : '',
), WATCHDOG_DEBUG);
}
$return_var = 0;
ob_start();
passthru($command, $return_var);
$output = ob_get_clean();
// Returnvar 1 means input file not found. This is normal for information calls.
if ($return_var != 0 && ($return_var != 1 || !$ignoreoutputfilenotfound)) {
watchdog('video_command', 'Error executing command!purposetext:<br/><pre>@command</pre>Output:<br/><pre>@output</pre>', array(
'@command' => $command,
'@output' => trim($output),
'!purposetext' => $purposetext,
), WATCHDOG_ERROR);
return FALSE;
}
return TRUE;
}