Skip to content
Permalink
Browse files

Refresh Sitemap cronjob

  • Loading branch information...
MacGyver-NRW committed Mar 7, 2017
1 parent 5c61210 commit a854304272044aee96452f84b51578f9abb18061
Showing with 10 additions and 32 deletions.
  1. +2 −1 htdocs/lib2/logic/sitemapxml.class.php
  2. +8 −31 htdocs/util2/cron/modules/sitemaps.class.php
@@ -52,8 +52,9 @@ public function open($sPath, $sDomain)
* @param bool $sChangeFreq
* @param float $nPriority
*/
public function write($sFile, $dLastMod, $sChangeFreq = false, $nPriority = 0.5)
public function write($sFile, $dLastMod, $sChangeFreq = false, $nPriority )
{
if (!$nPriority) { $nPriority = 0.5; }
if ($sChangeFreq == false) {
$sChangeFreq = $this->sDefaultChangeFreq;
}
@@ -26,15 +26,11 @@ public function run()
$opt['page']['https']['mode'] == HTTPS_ENFORCED ? $opt['page']['absolute_https_url'] : $opt['page']['absolute_http_url']
);
$this->oSitemapXML->write('index.php', time(), 'always');
$this->oSitemapXML->write('index.php', time(), 'always', 1.0);
$this->oSitemapXML->write('tops.php', time() - 24 * 60 * 60, 'daily', 0.5);
$this->oSitemapXML->write('newcachesrest.php', time() - 24 * 60 * 60, 'daily', 0.5);
$this->write_viewacache_urls();
$this->write_articles_urls();
$this->write_viewlogs_urls();
$this->write_viewprofile_urls();
$this->oSitemapXML->write('tops.php', time() - 24 * 60 * 60, 'daily');
$this->oSitemapXML->write('newcachesrest.php', time() - 24 * 60 * 60, 'daily');
$this->write_newcaches_urls();
$this->oSitemapXML->write('newlogs.php', time(), 'always');
$this->oSitemapXML->close();
@@ -52,7 +48,7 @@ public function ping_searchengines()
($opt['page']['https']['mode'] == HTTPS_ENFORCED ? $opt['page']['absolute_https_url'] : $opt['page']['absolute_http_url']) . 'sitemap.xml'
);
$this->ping_searchengine('http://www.google.com/webmasters/tools/ping?sitemap=' . $url);
$this->ping_searchengine('http://www.google.com/webmasters/ping?sitemap=' . $url);
$this->ping_searchengine(
'http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=USERID&url=' . $url
);
@@ -92,36 +88,16 @@ public function write_newcaches_urls()
$nCount = sql_value("SELECT COUNT(*) FROM `caches` WHERE `caches`.`status`=1", 0);
$nIndex = 0;
while ($nIndex < $nCount) {
$this->oSitemapXML->write('newcaches.php?startat=' . $nIndex, time(), 'always');
$this->oSitemapXML->write('newcaches.php?startat=' . $nIndex, time(), 'always', 0.7);
$nIndex += 100;
}
}
public function write_viewprofile_urls()
{
$rs = sql("SELECT SQL_BUFFER_RESULT `user_id` FROM `user`");
while ($r = sql_fetch_assoc($rs)) {
$this->oSitemapXML->write('viewprofile.php?userid=' . $r['user_id'], time() - 31 * 24 * 60 * 60);
}
sql_free_result($rs);
}
public function write_viewlogs_urls()
{
$rs = sql(
"SELECT SQL_BUFFER_RESULT MAX(`last_modified`) AS `d`, `cache_id` FROM `cache_logs` GROUP BY `cache_id`"
);
while ($r = sql_fetch_assoc($rs)) {
$this->oSitemapXML->write('viewlogs.php?cacheid=' . $r['cache_id'], strtotime($r['d']));
}
sql_free_result($rs);
}

This comment has been minimized.

Copy link
@following5

following5 Sep 23, 2017

Contributor

Are you sure you want to remove the viewlogs pages from sitemap? The listings (viewcache) contain only the first five logs per cache.

This comment has been minimized.

Copy link
@teiling88

teiling88 Sep 24, 2017

Member

Are you sure you want to remove the viewlogs pages from sitemap?

Yes

public function write_articles_urls()
{
$rs = sql("SELECT `href` FROM `sys_menu` WHERE `href` LIKE 'articles.php?page=%'");
while ($r = sql_fetch_assoc($rs)) {
$this->oSitemapXML->write($r['href'], time() - 31 * 24 * 60 * 60);
$this->oSitemapXML->write($r['href'], time() - 31 * 24 * 60 * 60, 0.3);
}
sql_free_result($rs);
}
@@ -145,7 +121,8 @@ public function write_viewacache_urls()
);
$this->oSitemapXML->write(
'viewcache.php?wp=' . $r['wp_oc'] . '&desclang=' . $r['language'],
strtotime($dLastMod)
strtotime($dLastMod),
0.6
);
}
sql_free_result($rs);

0 comments on commit a854304

Please sign in to comment.
You can’t perform that action at this time.