brainstormmedia/uploads-by-proxy — pull request #2 by jrfoell (2013-09-18 22:08:03+00:00)
Title: Beginnings of multisite support

I started looking at multisite support for this, at first it didn't seem promising b/c ms-files.php doesn't have any hooks available to plugins... Then I found this ticket: http://core.trac.wordpress.org/ticket/19235 and this article: http://halfelf.org/2012/dumping-ms-files/

So if I force my local system to use the new style multisite files by adding to wp-config.php:

define( 'UBP_SITEURL', 'http://example.com' );
define( 'UPLOADBLOGSDIR', 'wp-content/uploads/sites' );

and removing this rule from my .htaccess:
# uploaded files
# RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

I could get uploads by proxy to retrieve the files from the live site and put them in the new wp-content/uploads/sites structure.

I also added a "UBP Site URL" setting to the site settings in wp-admin/network/ -> Sites -> All Sites -> Edit -> Settings Tab (very bottom). This will override the UBP_SITEURL define if present, incase someone wants to have a multisite setup where subsites point to completely unrelated live sites.

I haven't (yet) tested subdomains.