• Модуль: security
  • Путь к файлу: ~/bitrix/modules/security/classes/general/tests/site_configuration.php
  • Класс: CSecuritySiteConfigurationTest
  • Вызов: CSecuritySiteConfigurationTest::getAvailableUpdates
static function getAvailableUpdates()
{
	require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/classes/general/update_client.php');

	$errors = null;
	$installedModules = CUpdateClient::GetCurrentModules($errors);
	if ($errors !== null)
		throw new SystemException($errors);

	$stableVersionsOnly = COption::GetOptionString('main', 'stable_versions_only', 'Y');
	$errors = null;
	$updateList = CUpdateClient::GetUpdatesList($errors, LANG, $stableVersionsOnly);
	if ($errors !== null)
		throw new SystemException($errors);

	if (
		!isset($updateList['MODULES'])
		|| !is_array($updateList['MODULES'])
		|| !isset($updateList['MODULES'][0]['#'])
	)
	{
		throw new SystemException('Empty update modules list');
	}

	$result = array();
	if (!$updateList['MODULES'][0]['#'])
	{
		return $result;
	}

	if (
		!isset($updateList['MODULES'][0]['#']['MODULE'])
		|| !is_array($updateList['MODULES'][0]['#']['MODULE'])
	)
	{
		throw new SystemException('Empty update module list');
	}

	foreach ($updateList['MODULES'][0]['#']['MODULE'] as $module)
	{
		if (array_key_exists($module['@']['ID'], $installedModules))
			$result[] = $module['@']['ID'];
	}

	return $result;
}