- Issue created by @pfrenssen
Currently when the Gzip option is enabled, we are reading back the XML file in XmlSitemapWriter::endDocument()
using file_get_contents()
and compressing it before writing it back.
The problem is that it is not guaranteed that the file exists at this point. When using stream wrappers (e.g. using the S3FS module), the XML file is only written at the time the XmlSitemapWriter
object is deconstructed. The deconstruction of the object causes the file to be flushed, which triggers the writing of the file when using remote file systems.
A very similar issue was filed way back in 2014 for the D7 version of the module: see #2292717: XMLSitemapWriter::endDocument() calls filesize() prematurely. → .
drush xmlsitemap:regenerate
.Result: errors are thrown:
Error executing "GetObject" on "https://s3.eu-west-1.amazonaws.com/mybucket/public/xmlsitemap/NCkDAB1jjJ..."; AWS HTTP error: Client error: `GET https://s3.eu-west-1.amazonaws.com/mybucket/public/xmlsitemap/NCkDAB1jjJ...` resulted in a `404 Not Found` response
We shouldn't attempt to read the XML document that was just generated inside XmlSitemapWriter::endDocument()
. This should be moved to the calling code.
Active
1.0
Code