commit
c0395d2d5b
@ -2197,22 +2197,19 @@ if ($action == 'generatesitemaps') {
|
|||||||
}
|
}
|
||||||
$robotcontent = @file_get_contents($filerobot);
|
$robotcontent = @file_get_contents($filerobot);
|
||||||
$result = preg_replace('/<?php // BEGIN PHP[^?]END PHP ?>\n/ims', '', $robotcontent);
|
$result = preg_replace('/<?php // BEGIN PHP[^?]END PHP ?>\n/ims', '', $robotcontent);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$robotcontent = $result;
|
$robotcontent = $result;
|
||||||
}
|
}
|
||||||
$robotsitemap = "Sitemap: ".$domainname."/".$xmlname;
|
$robotsitemap = "Sitemap: ".$domainname."/".$xmlname;
|
||||||
$result = strpos($robotcontent, 'Sitemap: ');
|
$result = strpos($robotcontent, 'Sitemap: ');
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$result = preg_replace("/Sitemap.*\n/", $robotsitemap, $robotcontent);
|
$result = preg_replace("/Sitemap.*\n/", $robotsitemap, $robotcontent);
|
||||||
$robotcontent = $result ? $result : $robotcontent;
|
$robotcontent = $result ? $result : $robotcontent;
|
||||||
} else {
|
} else {
|
||||||
$robotcontent .= $robotsitemap."\n";
|
$robotcontent .= $robotsitemap."\n";
|
||||||
}
|
}
|
||||||
$result = dolSaveRobotFile($filerobot, $robotcontent);
|
$result = dolSaveRobotFile($filerobot, $robotcontent);
|
||||||
if (!$result)
|
if (!$result) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
|
setEventMessages('Failed to write file '.$filerobot, null, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user