Dodałem sobie do cron'a by odpalał się o 00:00, podpiąłem klase pod mojego cms'a, w którym mam w bazie zapisywane ostatnie modyfikacje dla rekordów, więc wstawiam unix timestamp do date("c", wartosc_time_z_bazy);.
I wprowadziłem małą zmianę, dodałem:
Kod
109>>
private $sitemapFullURLGZ;
224>>
if ($this->createGZipFile){
$this->sitemapFullURLGZ = $this->baseURL.$this->sitemapFileName.".gz";
}
$this->sitemapFullURL = $this->baseURL.$this->sitemapFileName;
268>>
public function updateRobots() {
if (!isset($this->sitemaps))
throw new BadMethodCallException("To update robots.txt, call createSitemap function first.");
$sampleRobotsFile = "User-agent: *\nAllow: /";
if (file_exists($this->basePath.$this->robotsFileName)) {
$robotsFile = explode("\n", file_get_contents($this->basePath.$this->robotsFileName));
$robotsFileContent = "";
foreach($robotsFile as $key=>$value) {
$value = trim($value);
if(substr($value, 0, 8) == 'Sitemap:') unset($robotsFile[$key]);
else $robotsFileContent .= $value."\n";
}
$robotsFileContent .= "Sitemap: " . $this->sitemapFullURL;
if ($this->createGZipFile && !isset($this->sitemapIndex)){
$robotsFileContent .= "\nSitemap: ".$this->sitemapFullURLGZ;
}
file_put_contents($this->basePath.$this->robotsFileName,$robotsFileContent);
} else {
$sampleRobotsFile = $sampleRobotsFile."\n\nSitemap: ".$this->sitemapFullURL;
if ($this->createGZipFile && !isset($this->sitemapIndex)){
$sampleRobotsFile .= "\nSitemap: ".$this->sitemapFullURLGZ;
}
file_put_contents($this->basePath.$this->robotsFileName, $sampleRobotsFile);
}
}
Bo w pliku robots robiło pierwszą nazwę pliku mapy z rozszerzeniem .gz i pod nią drugą z .gz.gz.
Kod
Sitemap: http://192.168.0.2/strona/xml/sitemap.xml.gz
Sitemap: http://192.168.0.2/strona/xml/sitemap.xml.gz.gz
Teraz już nie ma tego problemu.