public function XmlSitemapWriter::endDocument in XML sitemap 2.x
Same name and namespace in other branches
- 8 src/XmlSitemapWriter.php \Drupal\xmlsitemap\XmlSitemapWriter::endDocument()
Ends an XML document.
Return value
bool Returns TRUE on success.
Throws
File
- src/
XmlSitemapWriter.php, line 242
Class
- XmlSitemapWriter
- Extended class for writing XML sitemap files.
Namespace
Drupal\xmlsitemapCode
public function endDocument() {
$return = parent::endDocument();
if (!$return) {
throw new XmlSitemapGenerationException("Unknown error occurred while writing to file {$this->uri}.");
}
if (xmlsitemap_var('gz')) {
$file_gz = $this->uri . '.gz';
file_put_contents($file_gz, gzencode(file_get_contents($this->uri), 9));
}
return $return;
}