• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/update_class.php
  • Класс: CUpdater
  • Вызов: CUpdater::QueryBatch
function QueryBatch($queryPath, $tableName = "")
{
	if (!in_array("DATABASE", $this->callType))
		return false;

	CUpdateSystem::AddMessage2Log("Run updater '".$this->updater."': QueryBatch(".$queryPath.", ".$tableName.")", "CRUPDCDF3");

	$bCanUpdate = true;
	if ($tableName <> '')
		if (!$this->TableExists($tableName))
			$bCanUpdate = false;

	$result = false;

	if ($bCanUpdate)
	{
		$strQueryPath = "";

		if (is_array($queryPath))
		{
			foreach ($queryPath as $key => $value)
			{
				if ($this->dbType == StrToUpper($key))
				{
					$strQueryPath = $value;
					break;
				}
			}
		}
		else
		{
			$strQueryPath = $queryPath;
		}

		if ($strQueryPath == '')
			$bCanUpdate = false;
	}

	if ($bCanUpdate)
	{
		if (substr($strQueryPath, 0, 1) != "/")
			$strQueryPath = $this->curPath."/".$strQueryPath;

		$queryPathFull = $_SERVER["DOCUMENT_ROOT"].$strQueryPath;

		$arError = false;
		if (file_exists($queryPathFull))
			$arError = $GLOBALS["DB"]->RunSQLBatch($queryPathFull);

		if ($arError)
		{
			foreach ($arError as $key => $value)
				$this->errorMessage[] = $value;
		}
	}

	return ($arError ? false : true);
}