diff --git a/bin/console b/bin/console index 3aec5dd5b8..60276cc330 100755 --- a/bin/console +++ b/bin/console @@ -27,6 +27,8 @@ $Core = require_once dirname(__FILE__) . '/../lib/bootstrap.php'; $result_code = 1; +$result_code = 1; + try { \bootstrap::register_autoloads(); @@ -81,11 +83,11 @@ try $app->add(new module_console_fieldsMerge('fields:merge')); - $result_code = $app->run(); + $result_code = $app->run() === 0 ? : 1; } catch (Exception $e) { - echo "an error occured";var_dump($e->getMessage()); + echo sprintf("an error occured : %s", $e->getMessage()); } exit($result_code); diff --git a/lib/classes/binaryAdapter/video/toimage/ffmpeg.class.php b/lib/classes/binaryAdapter/video/toimage/ffmpeg.class.php index 848cfdbe69..1b4c93bd56 100644 --- a/lib/classes/binaryAdapter/video/toimage/ffmpeg.class.php +++ b/lib/classes/binaryAdapter/video/toimage/ffmpeg.class.php @@ -24,7 +24,7 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb * @var array */ protected $options = array( - 'size' => null + 'size' => null ); /** @@ -42,7 +42,7 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb protected function process(system_file $origine, $dest) { $tmpDir = $this->registry->get('GV_RootPath') - . 'tmp/' . 'tmp' . time() . '/'; + . 'tmp/' . 'tmp' . time() . '/'; system_file::mkdir($tmpDir); $tmpFile = $tmpDir . 'extract-tmp.jpg'; @@ -61,25 +61,25 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb $dimensions = $this->get_dimensions($origine, $this->options['size']); $newHeight = $dimensions['height']; - $newWidth = $dimensions['width']; + $newWidth = $dimensions['width']; $system = system_server::get_platform(); if ($system == 'WINDOWS') { $cmd = $this->binary - . ' -i ' . $this->escapeshellargs($origine->getPathname()) - . ' -s ' . $newWidth . 'x' . $newHeight - . ' -vframes 1 -ss ' . $time_cut - . ' -f image2 ' . $this->escapeshellargs($tmpFile); + . ' -i ' . $this->escapeshellargs($origine->getPathname()) + . ' -s ' . $newWidth . 'x' . $newHeight + . ' -vframes 1 -ss ' . $time_cut + . ' -f image2 ' . $this->escapeshellargs($tmpFile); } else { $cmd = $this->binary - . ' -i ' . $this->escapeshellargs($origine->getPathname()) - . ' -s ' . $newWidth . 'x' . $newHeight - . ' -vframes 1 -ss ' . $time_cut - . ' -f image2 ' . $this->escapeshellargs($tmpFile); + . ' -i ' . $this->escapeshellargs($origine->getPathname()) + . ' -s ' . $newWidth . 'x' . $newHeight + . ' -vframes 1 -ss ' . $time_cut + . ' -f image2 ' . $this->escapeshellargs($tmpFile); } $this->shell_cmd($cmd); @@ -87,17 +87,27 @@ class binaryAdapter_video_toimage_ffmpeg extends binaryAdapter_video_processorAb if ($this->debug) $this->log("Commande executee : $cmd \n"); - if (!file_exists($tmpFile)) + if ( ! file_exists($tmpFile)) + { throw new Exception('Unable to extract image'); + } - $cmd = $this->registry->get('GV_pathcomposite') - . ' -gravity SouthEast -quiet -compose over "' - . $this->registry->get('GV_RootPath') . 'www/skins/icons/play.png"' - . ' ' . $this->escapeshellargs($tmpFile) - . ' ' . $this->escapeshellargs($dest); + if (file_exists($this->registry->get('GV_RootPath') . 'www/skins/icons/play.png')) + { + $cmd = $this->registry->get('GV_pathcomposite') + . ' -gravity SouthEast -quiet -compose over "' + . $this->registry->get('GV_RootPath') . 'www/skins/icons/play.png"' + . ' ' . $this->escapeshellargs($tmpFile) + . ' ' . $this->escapeshellargs($dest); + + $this->shell_cmd($cmd); + unlink($tmpFile); + } + else + { + rename($tmpFile, $dest); + } - $this->shell_cmd($cmd); - unlink($tmpFile); rmdir($tmpDir); return $this; diff --git a/lib/classes/module/console/schedulerState.class.php b/lib/classes/module/console/schedulerState.class.php index c0508144fd..61717e3d71 100644 --- a/lib/classes/module/console/schedulerState.class.php +++ b/lib/classes/module/console/schedulerState.class.php @@ -70,7 +70,7 @@ class module_console_schedulerState extends Command return 1; } - return; + return 0; } } diff --git a/lib/classes/module/console/schedulerStop.class.php b/lib/classes/module/console/schedulerStop.class.php index 8e9c9408c7..333403cde0 100644 --- a/lib/classes/module/console/schedulerStop.class.php +++ b/lib/classes/module/console/schedulerStop.class.php @@ -58,7 +58,7 @@ class module_console_schedulerStop extends Command return 1; } - return; + return 0; } } diff --git a/lib/classes/module/console/systemUpgrade.class.php b/lib/classes/module/console/systemUpgrade.class.php index 9c8b24fa95..3e8ff24c7e 100644 --- a/lib/classes/module/console/systemUpgrade.class.php +++ b/lib/classes/module/console/systemUpgrade.class.php @@ -111,7 +111,7 @@ class module_console_systemUpgrade extends Command } $output->write('Finished !', true); - return; + return 0; } }