Currently Stage File Proxy assumes that the file path is the same on both systems.

While this works fine on single site installs, where the public file system path is always 'sites/default/files' regardless of url, it fails when working in a multisite environment where you may have a dev site with the path 'sites/dev.siteurl.com/files' and a staging site with 'sites/stage.siteurl.com/files', both pulling from the production site whose public files are in sites/siteurl.com/files.

Need to add an option to specify the remote file system path to query.

Comments

StephenBrown’s picture

StatusFileSize
new2.75 KB

Here is a patch against 7.x-1.x-dev, for testing and review. It appears to work without issue for me when simply downloading the files from production.

This basically adds another variable (stage_file_proxy_origin_dir) that allows you to specify the public files system path of the remote site. Initially I had also included some verification logic to make sure it was in the format 'sites/[sitedir]/files', but took that out because that's how it's specified in admin/config/media/file-system.
Also added some documentation in INSTALL.txt.

I may port this patch against 6.x-1.x-dev if the need arises. We're currently in the process of moving all our sites to Drupal 7 from 6, so that may not be necessary.

StephenBrown’s picture

StatusFileSize
new3.62 KB

Here is the same patch, but after first patching with the admin UI patch: http://drupal.org/files/admin-ui-d7-1014466-2.patch

cdracars’s picture

I have run across a need for this in D6. How hard is it to attempt a back port?

logaritmisk’s picture

Status: Active » Reviewed & tested by the community

Patch #1 works for me. Haven't tried #2 because I don't need the UI patch :). But I'm going to change this to RTBC.

greggles’s picture

Patch from #1 worked well for me as well.

greggles’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

portico’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Category: bug » feature
Status: Closed (fixed) » Patch (to be ported)

We should backport this to 6.x-1.x version.

greggles’s picture

Perhaps so. I don't use the 6.x version so I won't roll or test it, but if someone else does I'll happily commit.

td540’s picture

StephenBrown’s picture

StatusFileSize
new2.83 KB

I've taken the code patch I made for d7 and backported it over to 6.x-1.x-dev, turns out it's almost exactly the same. Haven't gotten a chance to test it yet, as I'm having issues with the site I was trying to test on. But, at least now it's available. A year later...

greggles’s picture

Status: Patch (to be ported) » Needs review

Thanks, StephenBrown!

If anyone can test please post your results here.

samuel.mortenson’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Tested on a local multisite installation, this seems to work fine on one of my sites with multisite-specific files. Getting this into the dev branch would be great :)

greggles’s picture

Status: Reviewed & tested by the community » Needs work

The patch in #11 doesn't apply. Reroll?

samuel.mortenson’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new2.72 KB

Rerolled, and removed lines involving the dir_path variable as it is no longer used.

greggles’s picture

Anyone else able to review that?

samuel.mortenson’s picture

Status: Reviewed & tested by the community » Needs review
texas-bronius’s picture

For what it's worth, the latest D6 patch appears to want to work, but for my particular domains it does not.

For prod domains example.org and subsite.example.org, I use stage_file_proxy_origin = http://example.org (the default host), and the resulting URI generated to make the request does look under the correct multisite folder on production (sites/subsite.example.org/files..) but fails to retrieve the resource. Or so it appears.. I can't seem to get it to reproduce the watchdog notice again, now. :)

thinkyhead’s picture

The patch at https://www.drupal.org/node/2625126 has this covered, plus I've added some extra enhancements to cover more cases, including cck filefield. If you're like me, you still have a few D6 sites to port and maintain even now as 2016 approaches. So it's good to keep this module fresh and up-to-date for the time being!

asrob’s picture

Status: Needs review » Closed (won't fix)

I would close this issue because Drupal 6 reached EOL. See https://www.drupal.org/drupal-6-eol.