I'd like to learn how to sync the files/images paths of my multi-site dev site to its live site so that I can stop having to replace the path names within mysql every time I update the database of one or the other.
Dev site image path: sites/water.uida.local/files/images
Live site image path: sites/water.uida.edu/files/images
OS: XP local and Win Server 2003 for live Apache 2triad on both
While using relative paths, I still have to change water.uidaho.edu to water.uidaho.local when I update the dev site's database with the live site's database.
From my days of research, I figure I have four options but all of them have drawbacks, so I'm not sure what the majority does..or what the best practice is? And, maybe I've overlooked something.
Option One: Use pathologic. Displays image paths fine but problem will occur when editing published nodes with faulty image paths
Option Two: Sym links. I think Win Server has the capacity -- read it somewhere -- but XP does not have symlinks .
Option Three: Replace dev domain with the real domain name so folders on live and dev site match. Easiest option. Drawback ..have to fuss with hosts file commenting out/in domain name depending on desire to view live or prod site.
Option Four: Move drupal/sites/water.uidaho.dev /files/images to drupal/files/water/images and, change, of course, the system file path. This is interesting option suggested in one of the drupal forums. I am inclined to fret over what will happen to imagecache files. I have heard of problems.
I am, unfortunately, using fckeditor and tinymce, primarily because updates and additions will be performed by nontechies.
Can anybody help me sort out what to do?
Comments
I uh *gasp* hack core
I use this patch to take care of it. It is the approach used in D7. http://drupal.org/files/issues/multisite-d6-1.patch
This patch allows you to create a sites.php file that creates an array like this:
$sites = array('water.uida.local' => 'water',
'water.uida.edu' => 'water',
);
Then your sites directory looks like
drupal/sites/water/blah
Then all images and files use the same directory path no matter if you are on local or live.
Thanks much for the reply.
Thanks much for the reply. Right now, I am starting the read of the issues post you provided. TY! I am not a developer..have never done a patch....and wondering about the steps that I will take. I'll read it first and see if I can figure out on my own. Hoping, though, that you might lend a hand to this programming idiot if I get bogged down??
I know that patching core is big no-no. But what I wonder is how do you leave/alert someone else that they can't just update core once it's patched? Short of the obvious (tell 'em!), I know in the future I'll be handing off the site to others and I'd like to leave comments somewhere that caution them or alert them to how to modify the update process. How do you handle that?
I am wondering if anyone has
I am wondering if anyone has used cog.rusty's suggestion for this problem --- see: http://drupal.org/node/336682#comment-1117269
Pro's con's of that method versus the core hack?
Usually people leave a
Usually people leave a hacks.txt file or something in the directory. We have a place where we document all changes and what goes on with the site. We also have step by step instructions on how to upgrade. So we always reference those when we do something.
As far as applying the patch the easiest way of doing it is if you have a linux box you can just download the patch and apply it. Let's say your directory structure is /var/www/drupal/sites then download the patch into /var/www then go to /var/www/drupal and run patch -p0 < ../thepatch.patch Then this will apply the fixes you need.
Hacks / Upgrade --->
Hacks / Upgrade ---> Excellent, common-sense suggestions. Thank you. I plan on adopting those ideas.
Linux -- nope, don't have. XP for local and Win Server 2003 for production. Org owns server.
Patch -- thinking about doing it manually - = delete and + = insert/add
You didn't like cog.rusty's method?
I've never tried it and in
I've never tried it and in theory it should work and shorten your urls. I know that in d7 they are using the method I am using so I can continue it when I move to d7. Takes away the patch issue.
You've persuaded me. I
You've persuaded me. I believe this should also fix inline references to images made within a node's nasty WYSIWYG fckeditor -- where it creates absolute urls even when I try to force them to be relative within source window.
If you find a little bit of time, could you please see if my steps below are right? Hopefully, this newbie is learning....
Going this route on an established site (has dev and live site), I:
.............. sites/water.uida.local becomes sites/water
...............sites/water.uida.edu becomes sites/water
<?php$sites = array(
'water.uida.local' => 'water',
'water.uida.edu' => 'water',
);
?>
Clear caches / update database... that should be it?
Documentation
I just finished reading the comments re documentation of this patch and porting (not) to D6. My experience is that, while I am a voracious reader, without your post I would not have come across this patch. I thought I would mention it on the multisite page of the documentation for 6 but I see that only child pages are allowed. I just wanted to add this as a comment to that page. But, neverthless, my point is that it really should be mentioned in the D6 pages somewhere. Not sure how to make that happen..
That is correct. I would
That is correct. I would create a sub page underneath this link http://drupal.org/getting-started/6/install/multi-site With steps on how to setup a multisite using sites.php Then add a link to the patch for d6 users.
Thanks for the scan of my
Thanks for the scan of my steps! Ok, I'll go ahead and create the sub page -- using the steps I outlined above, although the order needs attention. So glad that after all this time I am finally "getting" Drupal, although the learning curve has been, well, h*ll. Feel free to take a look at that subpage you are recommending ...and edit where you see necessary. Your the guru; I'm just the apprentice!
Ignore
Ignore
Your post re var placement
You wrote: Let's say your directory structure is /var/www/drupal/sites then download the patch into /var/www then go to /var/www/drupal and run patch -p0 < ../thepatch.patch Then this will apply the fixes you need.
OK...my directory structure is /htdocs/drupal/sites and after re-reading what you wrote, I'm put the patch into htdocs instead but that seems strange. Anywho, I used cygwin/patch utility to run and it was successful, except for one error. Do I need to be concerned about the hunk failure?
Sunni Freyer@rainbowend /cygdrive/c/apache2triad/htdocs/drupal
$ patch -p0 <../multisite-d6-2.patch
patching file CHANGELOG.txt
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file CHANGELOG.txt.rej
patching file includes/bootstrap.inc
patching file sites/default.sites.php
Sunni Freyer@rainbowend /cygdrive/c/apache2triad/htdocs/drupal
$
yes failed hunks are bad.
yes failed hunks are bad. You might want to manually patch the file then. You can create another diff, but that will get more involved.
Hmmm. I have carefully
Hmmm. I have carefully checked the bootstrap.inc and sites.php file. I followed instructions to the letter. All looks perfect. My result? On my local computer, when I type http://water.uidaho.local, I now get the Drupal installation page.
I feel I have bothered you too much so I am asking for support in the Drupal issues forum.
The "hunk" that failed with the changelog. txt. That shouldn't be a problem, though, right?
Sorry I didn't notice that it
Sorry I didn't notice that it was the changelog that was failing.
No problem feel free to keep asking questions here. Are you sure your settings.php file is correct that is in water directory?
Oh boy, thanks so much. I
Oh boy, thanks so much. I really hate imposing on your time. :-( My head says this should be easy and I should be able to figure it out. So angry at myself for not being able to solve solo.
** Settings.php --> This is an established site, so yep, the settings.php file is located in drupal/sites/water/settings.php
** The base url in settings is uncommented. It still points to http://water.uidaho.local
** Did I need to make any changes in settings.php??
I changed the folder name back to drupal/sites/water.uidaho.local and all works fine.
I have dev set up using virtual hosts on winxp with apache2triad -- simple set up. Hosts file points water.uidaho.local to apache2triad/htdocs/drupal
The one thing I did different from your instructions is I used: multisite-d6-2.patch rather than multisite-d6-1.patch Is that the problem??
My files are here: http://drupal.org/node/642836
Any suggestions on what to do next??
did you name it sites.txt or
did you name it sites.txt or sites.php?
Edit: whoops didn't read you renamed it for upload.
Ahh I see. sites.php should
Ahh I see. sites.php should be in /sites not /sites/water
Ahh. OK...I'll move the file
Ahh. OK...I'll move the file and see what happens. Will report back. I published that how-to subpage we talked about (above) so need to correct errors or I'll create more support requests!
Update: Hooray! Good job
Update:
Hooray! Good job Adam! I moved that file, brought up the site, couldn't get it...so reran cron, flushed all caches, and ran update. That brought the site up -- without any images/files. But that's explainable as they are being called from /sites/water now
So, us newbies have to be banged over the head with these little details, which I will add to the documentation I published at http://drupal.org/node/642712
For my live site, I can simply upload all of this from dev site rather than making the same changes there... Is that the best practice or should I do it all over right on the live site?
THANK YOU...........
P.S. I keep wishing that Drupal leadership (who?) would create a "Top Volunteers Who Have Supported Others This Year" section with a "Say thanks with a click" and let people donate green to people like you. Without you giving of your time, new Drupal folks would drown. Do you know who I would suggest that to? Do you think the idea has any merit?
I am glad you got it working.
I am glad you got it working. For your live site it depends on if you have the ability to keep people from posting. What I would do is bring all the data down from the live site to your development site. Do the upgrade and write down step by step instructions on what it took. Then when you are ready take your live site offline, backup your site, and then proceed with your upgrade. Verify it worked then go back live.
That's a good idea about donations, although I am not sure who you really approach with that. If you would like to donate something to the people who've helped you many times people will put up ways to donate to them in their profile page. You can click on my name in the posts for how I have added mine.
red, shame, shame, shame on
red, shame, shame, shame on you for encouraging the newbie to hack core. You led the poor child down the kitten-corpse-strewn path of darkness.
Apache URL rewriting isn't an option I saw discussed here. Would it not work to simply tell Apache on the local server to redirect requests for sites/water.uida.edu to sites/water.uida.local?
But backing up further, I was somewhat surprised by the comment:
Are not Windows shortcuts functionally identical? That would have been the first thing I tried.
As for Pathologic, I don't think it will help you in this particular case (and I say that as Pathologic's author).
The Boise Drupal Guy!
I know, I know, but the hack
I know, I know, but the hack is in D7 so you don't have to do anything when moving up and the hack is a whole lot easier than managing the database appropriately.
The problem isn't as much the url as the database. So apache URL rewriting won't work.
Shortcuts are not the same as symlinks. In windows let's say I have a a shortcut called "my_sites" in c:\ pointing to c:\sites . If I run cmd I cannot type cd c:\my_sites . It will say the directory does not exist. Shortcuts is a GUI thing not an actual file system thing.