Fix can add a redirection into the executeCLI method.
This commit is contained in:
parent
34c1991730
commit
eec5fba333
@ -593,12 +593,14 @@ class Utils
|
|||||||
/**
|
/**
|
||||||
* Execute a CLI command.
|
* Execute a CLI command.
|
||||||
*
|
*
|
||||||
* @param string $command Command line to execute.
|
* @param string $command Command line to execute.
|
||||||
* @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp';
|
* Warning: The command line is sanitize so can't contains any redirection char '>'. Use param $redirectionfile if you need it.
|
||||||
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
|
* @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp';
|
||||||
* @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK.
|
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
|
||||||
|
* @param string $redirectionfile If defined, file to redirect output to.
|
||||||
|
* @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK.
|
||||||
*/
|
*/
|
||||||
public function executeCLI($command, $outputfile, $execmethod = 0)
|
public function executeCLI($command, $outputfile, $execmethod = 0, $redirectionfile = null)
|
||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
@ -607,6 +609,9 @@ class Utils
|
|||||||
$error = '';
|
$error = '';
|
||||||
|
|
||||||
$command = escapeshellcmd($command);
|
$command = escapeshellcmd($command);
|
||||||
|
if ($redirectionfile) {
|
||||||
|
$command .= " > ".dol_sanitizePathName($redirectionfile);
|
||||||
|
}
|
||||||
$command .= " 2>&1";
|
$command .= " 2>&1";
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
|
if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user