$msg = Loc::getMessage('SITEMAP_RUN_FORUM'); } } else { if ($v < $arValueSteps['forum']) { $stepDuration = 10; $ts_finish = microtime(true) + $stepDuration * 0.95; $bFinished = false; $bCheckFinished = false; $currentForum = false; $forumId = 0; $dbTopicResult = null; $arTopic = null; while (!$bFinished && microtime(true) <= $ts_finish && CModule::IncludeModule("forum")) { if (!$currentForum) { $arCurrentForum = false; $dbRes = SitemapRuntimeTable::getList(array('order' => array('ID' => 'ASC'), 'filter' => array('PID' => $PID, 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_FORUM, 'PROCESSED' => SitemapRuntimeTable::UNPROCESSED), 'limit' => 1)); $currentForum = $dbRes->fetch(); if ($currentForum) { $forumId = intval($currentForum['ITEM_ID']); $db_res = CForumNew::GetListEx(array(), array('ID' => $forumId, "ACTIVE" => "Y", "SITE_ID" => $arSitemap['SITE_ID'], "!TOPICS" => 0)); $arCurrentForum = $db_res->Fetch(); if (!$arCurrentForum) { SitemapRuntimeTable::update($currentForum['ID'], array('PROCESSED' => SitemapRuntimeTable::PROCESSED)); } else { $fileName = str_replace('#FORUM_ID#', $forumId, $arSitemap['SETTINGS']['FILENAME_FORUM']); $sitemapFile = new SitemapRuntime($PID, $fileName, $arSitemapSettings); } } } if (!$currentForum) { $bFinished = true;
} } } else { $arSection = $dbIblockResult->fetch(); if ($arSection) { $bCheckFinished = false; $sectionLastmod = MakeTimeStamp($arSection['TIMESTAMP_X']); $NS['LEFT_MARGIN'] = $arSection['LEFT_MARGIN']; $NS['IBLOCK_LASTMOD'] = max($NS['IBLOCK_LASTMOD'], $sectionLastmod); $bActive = false; $bActiveElement = false; if (isset($arSitemap['SETTINGS']['IBLOCK_SECTION_SECTION'][$iblockId][$arSection['ID']])) { $bActive = $arSitemap['SETTINGS']['IBLOCK_SECTION_SECTION'][$iblockId][$arSection['ID']] == 'Y'; $bActiveElement = $arSitemap['SETTINGS']['IBLOCK_SECTION_ELEMENT'][$iblockId][$arSection['ID']] == 'Y'; } elseif ($arSection['IBLOCK_SECTION_ID'] > 0) { $dbRes = SitemapRuntimeTable::getList(array('filter' => array('PID' => $PID, 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_SECTION, 'ITEM_ID' => $arSection['IBLOCK_SECTION_ID'], 'PROCESSED' => SitemapRuntimeTable::PROCESSED), 'select' => array('ACTIVE', 'ACTIVE_ELEMENT'), 'limit' => 1)); $parentSection = $dbRes->fetch(); if ($parentSection) { $bActive = $parentSection['ACTIVE'] == SitemapRuntimeTable::ACTIVE; $bActiveElement = $parentSection['ACTIVE_ELEMENT'] == SitemapRuntimeTable::ACTIVE; } } else { $bActive = $arSitemap['SETTINGS']['IBLOCK_SECTION'][$iblockId] == 'Y'; $bActiveElement = $arSitemap['SETTINGS']['IBLOCK_ELEMENT'][$iblockId] == 'Y'; } $arRuntimeData = array('PID' => $PID, 'ITEM_ID' => $arSection['ID'], 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_SECTION, 'ACTIVE' => $bActive ? SitemapRuntimeTable::ACTIVE : SitemapRuntimeTable::INACTIVE, 'ACTIVE_ELEMENT' => $bActiveElement ? SitemapRuntimeTable::ACTIVE : SitemapRuntimeTable::INACTIVE, 'PROCESSED' => SitemapRuntimeTable::PROCESSED); if ($bActive) { $NS['IBLOCK'][$iblockId]['S']++; $url = \CIBlock::ReplaceDetailUrl($arSection['SECTION_PAGE_URL'], $arSection, false, "S"); $sitemapFile->addIBlockEntry($url, $sectionLastmod); }