function validateExecPath($prog, $path) { if (!$path) { return false; } list($output, $return) = exec_shell($path . ' 2>&1'); if ($prog == 'ffmpeg') { return $return != 127 && preg_match('#FFmpeg#i', $output); } elseif ($prog == 'flvtool2') { return $return != 127 && preg_match('#FLVTool2#i', $output); } elseif ($prog == 'mencoder') { return $return != 127 && (preg_match('#MEncoder#i', $output) || preg_match('#MPlayer#i', $output)); } else { return false; } }
$sCurrentWorkingDir = getcwd(); chdir($sDeployDirPath); //Update if (file_exists($sDeployDirPath . DIRECTORY_SEPARATOR . 'composer.lock')) { if ($bVerbose) { $oConsole->writeLine(PHP_EOL . ' * Composer update', \Zend\Console\ColorInterface::LIGHT_MAGENTA); } if (($iReturn = exec_shell($sComposerSelfUpdateCommand = 'php ' . $sDeployComposerPharPath . ' update', $bVerbose ? $oConsole : null)) !== 0) { throw new \RuntimeException('An error occurred while running "' . $sComposerSelfUpdateCommand . '"'); } chdir($sCurrentWorkingDir); } else { if ($bVerbose) { $oConsole->writeLine(PHP_EOL . ' * Composer install', \Zend\Console\ColorInterface::LIGHT_MAGENTA); } if (($iReturn = exec_shell($sComposerSelfUpdateCommand = 'php ' . $sDeployComposerPharPath . ' install', $bVerbose ? $oConsole : null)) !== 0) { throw new \RuntimeException('An error occurred while running "' . $sComposerSelfUpdateCommand . '"'); } chdir($sCurrentWorkingDir); } } if ($bVerbose) { $oConsole->writeLine(PHP_EOL . '### Module "' . $sCurrentModuleName . '" has been deployed into into "' . $sDeployDirPath . '" with success ###' . PHP_EOL, \Zend\Console\ColorInterface::GREEN); } exit(0); } catch (\Exception $oException) { $oConsole->writeLine(PHP_EOL . '======================================================================', \Zend\Console\ColorInterface::GRAY); $oConsole->writeLine('An error occured : ' . $oException->getMessage(), \Zend\Console\ColorInterface::RED); $oConsole->writeLine('======================================================================', \Zend\Console\ColorInterface::GRAY); if ($bVerbose) { $oConsole->writeLine($oException . PHP_EOL);