if (empty($arSitemap['SETTINGS']['FILENAME_FORUM'])) {
            $arSitemap['SETTINGS']['FILENAME_FORUM'] = "sitemap_forum_#FORUM_ID#.xml";
        }
        $SITE_ID = $arSitemap['SITE_ID'];
    }
}
if (strlen($SITE_ID) > 0) {
    $dbSite = Main\SiteTable::getByPrimary($SITE_ID);
    $arSite = $dbSite->fetch();
    if (!is_array($arSite)) {
        $SITE_ID = '';
    } else {
        $arSite['DOMAINS'] = array();
        $robotsFile = new RobotsFile($SITE_ID);
        if ($robotsFile->isExists()) {
            $arHostsList = $robotsFile->getRules('Host');
            foreach ($arHostsList as $rule) {
                $host = $rule[1];
                if (strncmp($host, 'https://', 8) === 0) {
                    $host = substr($host, 8);
                    $bDefaultHttps = true;
                }
                $arSite['DOMAINS'][] = $host;
            }
        }
        if ($arSite['SERVER_NAME'] != '') {
            $arSite['DOMAINS'][] = $arSite['SERVER_NAME'];
        }
        $dbDomains = Bitrix\Main\SiteDomainTable::getList(array('filter' => array('LID' => $SITE_ID), 'select' => array('DOMAIN')));
        while ($arDomain = $dbDomains->fetch()) {
            $arSite['DOMAINS'][] = $arDomain['DOMAIN'];
Exemple #2
0
         } else {
             SitemapRuntimeTable::clearByPid($PID);
             $arFiles = array();
             $sitemapFile = new SitemapIndex($arSitemap['SETTINGS']['FILENAME_INDEX'], $arSitemapSettings);
             if (count($NS['XML_FILES']) > 0) {
                 foreach ($NS['XML_FILES'] as $xmlFile) {
                     $arFiles[] = new IO\File(IO\Path::combine($sitemapFile->getSiteRoot(), $xmlFile), $arSitemap['SITE_ID']);
                 }
             }
             $sitemapFile->createIndex($arFiles);
             $arExistedSitemaps = array();
             if ($arSitemap['SETTINGS']['ROBOTS'] == 'Y') {
                 $sitemapUrl = $sitemapFile->getUrl();
                 $robotsFile = new RobotsFile($arSitemap['SITE_ID']);
                 $robotsFile->addRule(array(RobotsFile::SITEMAP_RULE, $sitemapUrl));
                 $arSitemapLinks = $robotsFile->getRules(RobotsFile::SITEMAP_RULE);
                 if (count($arSitemapLinks) > 1) {
                     foreach ($arSitemapLinks as $rule) {
                         if ($rule[1] != $sitemapUrl) {
                             $arExistedSitemaps[] = $rule[1];
                         }
                     }
                 }
             }
             $v = $arValueSteps['index'];
         }
     }
 }
 if ($v == $arValueSteps['index']) {
     $msg = Loc::getMessage('SITEMAP_RUN_FINISH');
     SitemapTable::update($ID, array('DATE_RUN' => new Bitrix\Main\Type\DateTime()));