• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/configuration/appconfiguration.php
  • Класс: BitrixRestConfigurationAppConfiguration
  • Вызов: AppConfiguration::exportApp
static function exportApp($step, $setting)
{
	$return = [
		'FILE_NAME' => '',
		'CONTENT' => [],
		'NEXT' => false
	];

	$filter = [
		'!=STATUS' => AppTable::STATUS_LOCAL,
		'=ACTIVE' => AppTable::ACTIVE,
	];

	if (is_array($setting))
	{
		if (!empty($setting['APP_REQUIRED']) && is_array($setting['APP_REQUIRED']))
		{
			$filter = [
				[
					'LOGIC' => 'OR',
					$filter,
					[
						'=ID' => $setting['APP_REQUIRED'],
					],
				],
			];
		}
		elseif (array_key_exists('APP_USES_REQUIRED', $setting))
		{
			$filter = [];
			if (!empty($setting['APP_USES_REQUIRED']))
			{
				$filter = [
					'=ID' => $setting['APP_USES_REQUIRED'],
				];
			}
		}
	}

	if (!empty($filter))
	{
		$res = AppTable::getList(
			[
				'order' => [
					'ID' => 'ASC',
				],
				'filter' => $filter,
				'select' => [
					'ID',
					'CODE',
				],
				'limit' => 1,
				'offset' => $step,
			]
		);

		if ($app = $res->Fetch())
		{
			$return['FILE_NAME'] = $step;
			$return['NEXT'] = $step;
			$return['CONTENT'] = [
				'code' => $app['CODE'],
				'settings' => [],
			];
		}
	}

	return $return;
}