public static function ListNext($limit) { if ($ID = self::_ListNext($limit)) { if ($RESULT = self::RequestItemsNext($ID)) { if ($RESULT['COUNT'] > 0) { $arQueue = array(); foreach ($RESULT['DATA'] as $arRow) { self::Sync($RESULT['SERVICE'], $arRow, $arQueue); } if (count($arQueue) > 0) { foreach ($arQueue as $item) { $item['IBLOCK_ID'] = $RESULT['SERVICE']['IBLOCK_ID']; CIntranetSharepointQueue::Add($item); } } } } } return $ID; }
} } else { if ($arResult['RESULT']['COUNT'] > 0) { $arQueue = array(); foreach ($arResult['RESULT']['DATA'] as $arRow) { if (!CIntranetSharepoint::Sync($arResult['RESULT']['SERVICE'], $arRow, $arQueue)) { if ($ex = $APPLICATION->GetException()) { $arResult['ERROR'] = $ex->GetString(); } } } $arResult['QUEUE'] = false; if (count($arQueue) > 0) { foreach ($arQueue as $item) { $item['IBLOCK_ID'] = $arResult['RESULT']['SERVICE']['IBLOCK_ID']; if (CIntranetSharepointQueue::Add($item)) { $arResult['QUEUE'] = true; } } } } } } else { $arResult['RESULT'] = array('MORE_ROWS' => false); } if (!$arResult['RESULT']['MORE_ROWS']) { if ($_REQUEST['sync_action'] == 'queue') { CIntranetSharepoint::AgentQueue($arParams['IBLOCK_ID']); } elseif ($_REQUEST['sync_action'] == 'log') { CIntranetSharepoint::AgentUpdate($arParams['IBLOCK_ID']); }