• Модуль: scale
  • Путь к файлу: ~/bitrix/modules/scale/lib/provider.php
  • Класс: BitrixScaleProvider
  • Вызов: Provider::getList
static function getList($params = array())
{
	$result = array();
	$shellAdapter = new ShellAdapter();
	$execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/bx-provider -a list -o json");
	$jsonData = $shellAdapter->getLastOutput();

	if($execRes)
	{
		$arData = json_decode($jsonData, true);

		if(isset($arData["params"]) && isset($arData["params"]["providers"]) && is_array($arData["params"]["providers"]))
			$result = $arData["params"]["providers"];

		if(isset($params["filter"]) && is_array($params["filter"]))
		{
			foreach($params["filter"] as $filterKey => $filterValue)
			{
				foreach($result as $providerId => $providerParams)
				{
					if(!array_key_exists($filterKey, $providerParams) || $providerParams[$filterKey] != $filterValue)
					{
						unset($result[$providerId]);
					}
				}
			}
		}

	}

	return $result;
}