In issue #920062 drupal_realpath() was introduced into the openUri call in xmlsitemap.xmlsitemap.inc
You should *not* be using this function as it completely breaks support for using stream wrappers on remote file systems.
Take a look at the API documention http://api.drupal.org/api/drupal/includes%21file.inc/function/drupal_rea...
Returns the absolute local filesystem path of a stream URI.
This function was originally written to ease the conversion of 6.x code to use 7.x stream wrappers. However, it assumes that every URI may be resolved to an absolute local filesystem path, and this assumption fails when stream wrappers are used to support remote file storage. Remote stream wrappers may implement the realpath method by always returning FALSE. The use of drupal_realpath() is discouraged, and is slowly being removed from core functions where possible.
Only use this function if you know that the stream wrapper in the URI uses the local file system, and you need to pass an absolute path to a function that is incompatible with stream URIs.
@todo: This function is deprecated, and should be removed wherever possible.
My system works perfectly fine to merely remove drupal_realpath($uri) and replace with just $uri for that call, though I'm not sure exactly what you were trying to accomplish by adding it before. Please use something that is portable and not reliant on a local filesystem/deprecated.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | remove_drupal_realpath-1460594.patch | 502 bytes | tripper54 |
Comments
Comment #1
coderintherye commentedTo further clarify, users using remote filesystems will experience the same errors as some people reported in http://drupal.org/node/920062 which are of the form: WD xmlsitemap: XMLSitemapGenerationException: Could not open file ..../1.xml for writing. in XMLSitemapWriter->openUri()
Comment #2
heathclifff commentedHas there been any movement on this? I am having this exact problem and am very interested in having a version of this module which will work locally even if I am using remote file storage (such as amazon s3). Do you have a patch file I could use to get started? Thanks.
Comment #3
coderintherye commentedWell, I haven't made a patch since I doubt that will be accepted, but basically just change line 40 of xmlsitemap.xmlsitemap.inc from
to instead be
Comment #4
Anonymous (not verified) commentedComment #5
tripper54 commentedPatch attached for review - simply made the changes in #3.
Thanks @coderintherye.
This fixed the errors on my site, which uses s3 as its default storage location.
Comment #6
Anonymous (not verified) commentedComment #7
coderintherye commentedNice, thanks for patching & reviewing, I hope to see this make it in.
Comment #8
sealionking commentedthanks very much
it works for mine with s3
Comment #9
dave reidSo if this works for remote file systems, how does this work on systems where using $uri natively was an issue, like Windows? Does this cause a regression?
Comment #10
coderintherye commentedPossibly, is there a test case for that? Or a windows test machine we can throw a potential test case at if we were to create a simpletest for it?
Comment #11
Anonymous (not verified) commentedI'm testing this on my WAMP. So far so good. Where would one expect to see an issue? There is none going to sitemap.xml.
Comment #12
coderintherye commentedI believe any issue here would be that the file itself would not be generated properly, so if it works to delete the file and the module recreates it, and updates it when you add a new node, and in addition you can open the sitemap.xml via a browser, then it should be all good.
Comment #13
bkonetzny commentedPatch from #5 solves my problems with xmlsitemap and s3, thanks! :)
Comment #14
mgiffordWould be great to get this in. It's blocking Amazon S3 #2195943: XMLSitemap Fails to Load with AmazonS3 Enabled
The RTBC patch is from 2012. Can we get it in?
Comment #15
dave reidCommitted #5 to 7.x-2.x. Thanks everyone and apologies this was left for so long.
http://drupalcode.org/project/xmlsitemap.git/commit/f1a56a9
Comment #16
mgiffordThanks Dave!