Beispiel #1
0
 //论坛数据中最大tid
 $count = $maxTid - $sitemapMaxTid;
 //新数据够生成一个sitemap时,生成新的sitemap
 if (!$sitemapMaxTid || $count >= $config['sitemapItemCount']) {
     $sitemapCount = ceil($count / $config['sitemapItemCount']);
     $next_tid = $sitemapMaxTid + 1;
     for ($i = 0; $i < $sitemapCount; $i++) {
         $start_tid = $next_tid + $i * $config['sitemapItemCount'];
         $end_tid = $start_tid + $config['sitemapItemCount'] - 1;
         $url = 'm=sitemapall&start=' . $start_tid;
         BaidusubmitSitemap::addSitemap($url, BaidusubmitSitemap::TYPE_ALL, $start_tid, $end_tid);
     }
 }
 BaidusubmitSitemap::printIndexHeader();
 $site = BaidusubmitOptions::getOption('siteurl');
 $sitemapCount = BaidusubmitSitemap::getSitemapCount(BaidusubmitSitemap::TYPE_ALL);
 $sitemapUrlCount = $config['sitemapUrlCount'] > 0 ? intval($config['sitemapUrlCount']) : 50000;
 //全取出来
 if ($sitemapCount <= $sitemapUrlCount) {
     $sitemaplist = BaidusubmitSitemap::getSitemapList(BaidusubmitSitemap::TYPE_ALL, 0, $sitemapCount);
     if (count($sitemaplist) > 0) {
         BaidusubmitSitemap::printSitemapList($sitemaplist, $site, $urlsuffix);
     }
     BaidusubmitSitemap::printIndexFooter();
     BaidusubmitSitemap::setIndexLastCrawl(0);
     return 1;
 }
 //分段取
 $lastcrawl = BaidusubmitSitemap::getIndexLastCrawl();
 $time = time();
 $pasttime = $time - $lastcrawl['stime'];