• Модуль: scale
  • Путь к файлу: ~/bitrix/modules/scale/lib/action.php
  • Класс: BitrixScaleAction
  • Вызов: Action::makeStartCommand
protected function makeStartCommand($inputParams = array())
{
	if(!is_array($inputParams))
		throw new BitrixMainArgumentTypeException("inputParams", "array");

	$retStr = $this->actionParams["START_COMMAND_TEMPLATE"];

	foreach ($this->userParams as $key => $paramValue)
	{
		if($this->actionParams['USER_PARAMS'][$key]['THROUGH_FILE'] == 'Y')
		{
			if($paramValue <> '')
			{
				$tmpDir = Helper::getTmpDir();
				$tmpFile = $tmpDir.'/.'.randString();
				$res = File::putFileContents($tmpFile, $paramValue);

				if($res === false)
					return '';

				$paramValue = $tmpFile;
			}
		}

		$retStr = str_replace('##USER_PARAMS:'.$key.'##', $paramValue, $retStr);
	}

	if($this->serverHostname <> '' && $this->serverHostname != "global")
	{
		$serverParams = $this->getServerParams();
		$serverParams["hostname"] = $this->serverHostname;

		if(is_array($serverParams))
		{
			foreach ($serverParams as $key => $paramValue)
			{
				if(is_string($paramValue))
				{
					$retStr = str_replace('##SERVER_PARAMS:' . $key . '##', $paramValue, $retStr);
				}
			}
		}
	}

	if(!empty($inputParams))
		foreach ($inputParams as $key => $paramValue)
			$retStr = str_replace('##INPUT_PARAMS:'.$key.'##', $paramValue, $retStr);

	if(isset($this->actionParams["CODE_PARAMS"]) && is_array($this->actionParams["CODE_PARAMS"]))
	{
		foreach($this->actionParams["CODE_PARAMS"] as $paramId => $paramCode)
		{
			$res = eval($paramCode);
			$retStr = str_replace('##CODE_PARAMS:'.$paramId.'##', $res, $retStr);
		}
	}

	foreach ($this->freeParams as $key => $paramValue)
		$retStr = str_replace('##'.$key.'##', $paramValue, $retStr);

	return $retStr;
}