Feature #40555 ยป add_scripts_executecommand_arguments_parameter.patch

Timo Kiefer, 2012-09-03 13:01

View differences:

Classes/Core/Booting/Scripts.php
489 489
	 * @param string $commandIdentifier E.g. typo3.flow3:cache:flush
490 490
	 * @param array $settings The FLOW3 settings
491 491
	 * @param boolean $outputResults if FALSE the output of this command is only echoed if the execution was not successful
492
	 * @param array $arguments The command arguments, as a array map
492 493
	 * @return boolean TRUE if the command execution was successful (exit code = 0)
493 494
	 * @api
494 495
	 */
495
	static public function executeCommand($commandIdentifier, array $settings, $outputResults = TRUE) {
496
	static public function executeCommand($commandIdentifier, array $settings, $outputResults = TRUE, array $arguments = array()) {
496 497
		$subRequestEnvironmentVariables = array(
497 498
			'FLOW3_ROOTPATH' => FLOW3_PATH_ROOT,
498 499
			'FLOW3_CONTEXT' => $settings['core']['context']
......
509 510
				$command .= sprintf('SET %s=%s&', $argumentKey, escapeshellarg($argumentValue));
510 511
			}
511 512
		}
513
        
512 514
		$phpBinaryPathAndFilename = escapeshellcmd(\TYPO3\FLOW3\Utility\Files::getUnixStylePath($settings['core']['phpBinaryPathAndFilename']));
513 515
		$command .= sprintf('"%s" -c %s %s %s', $phpBinaryPathAndFilename, escapeshellarg(php_ini_loaded_file()), escapeshellarg(FLOW3_PATH_FLOW3 . 'Scripts/flow3.php'), escapeshellarg($commandIdentifier));
516
        
517
        foreach($arguments as $argumentKey => $argumentValue) {
518
            $command .= sprintf(' --%s %s', $argumentKey, escapeshellarg($argumentValue));
519
        }
520
        
514 521
		$output = array();
515 522
		exec($command, $output, $result);
516 523
		if ($outputResults || $result !== 0) {
517
- 
    (1-1/1)