CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Upgrading Drupal - best practices to protect CiviCRM
Pages: [1]

Author Topic: Upgrading Drupal - best practices to protect CiviCRM  (Read 2270 times)

Denver Dave

  • Ask me questions
  • ****
  • Posts: 471
  • Karma: 9
Upgrading Drupal - best practices to protect CiviCRM
March 04, 2010, 03:16:09 pm
Drupal 6.16

I know that this is a CiviCRM board, but I'm wondering the best practices to upgrade Drupal when running CiviCRM.  I just successfully upgraded to Drupal 6.16 on one of our test installations.   However, I felt like I was trying to change my socks while standing on my feet with my boots on.  How are people upgrading Drupal without risking their underlying CiviCRM installation?

I did it by

(1) Backing up the files in the sites/default directory and also the Drupal and CiviCRM databases (learned by lesson to backup the databases).

(2) Deleting the Drupal only sub folders with my hosts cpanel file management utility which seems to be much faster than deleting with cuteftp.   Holding my breath that I didn't delete a sub-folder with CiviCRM stuff.

(3) Upload the Drupal compressed file to the document root and expand it with the Cpanel utility (thanks for that tip, saves huge amounts of time)

(4) Within the Drupal_6.16 directory created by step 3, move all the files and folders to my old drupal directory

(5) Upload my old settings.php file to the sites/default directory

(6) Delete the drupal_6.16 directory that the files were moved out of and delete the compressed file

(7) Run the drupal update script

The above did work, but seems like it is very easy to make a mistake and delete a CiviCRM folder by mistake.  I'm pretty sure I could recover and hopefully I have any CiviCRM modified files, but the initial CiviCRM files did not get to their server locations with an upload of the original files, they were placed there by expanding the CiviCRM compressed installation file in the modules directory - it is extremely tedious to upload the individual CiviCRM files - much faster expand the compressed file.

Anyway, just felt that I was playing a risking game upgrading drupal.  It worked, but could have made a mistake - do others do Drupal upgrades differently in a safer way for their CiviCRM installations?

What is the best practice to upgrade drupal.

Thanks.

« Last Edit: March 04, 2010, 03:38:29 pm by Denver Dave »

pdowling

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 4
Re: Upgrading Drupal - best practices to protect CiviCRM
March 04, 2010, 05:15:36 pm
Here is what I do.  I didn't have a chance to test it just now so YMMV, but I think it is right.

1. Drupal expects all user files to be under the files folder (where ever you configure that to be).  It is usually under sites/default/files, or if you are using multisite under sites/yoursite.com/files (or some such).  So I recommend directing civicrm to put it's "user files" there as well (file attachments to contacts/custom fields, etc.).  I don't have all the configuration screens handy for that so you may have to fish around.

2. There are some civicrm specific files that won't end up in that files directory (or at least may not if you miss a configuration).  However, anything that doesn't end up there should at least end up somewhere under your civicrm module folder which should be at sites/all/modules/civicrm

3. When you upgrade a minor version of drupal, the only things that should be specific to your site should be the files folder, everything under the sites folder (which may include the files folder too), the .htaccess file (in case you made modifications), and maybe the robots.txt.  Assuming you didn't hack drupal core of course.

So here is what I do given the above (note I use shell access to do this from a command line which is much simpler)

- make sure you have database backups and full file backups!!!
- Clear the drupal cache (I've had issues with themes).
- Put the site in offline mode
- Rename your current drupal directory temporarily (if it was mydrupal, change it to tempmydrupal for example)
- Go to the directory above where your drupal directory was (so if it was in public_html/mydrupal go to public_html folder)
- Download latest drupal tarball to that directory
- Unpack it there (it will create a folder there with the fresh drupal called drupal6_1_6 or some such)
- Rename that new drupal folder to the name you old drupal folder was (i.e. mydrupal, so at this point mydrupal has just the new drupal core files!)
- Copy the .htaccess file from tempmydrupal to mydrupal (i.e. from your old install folder to your now new install folder)
- Copy the robots.txt file from tempmydrupal to mydrupal
- Remove the sites folder underneath the new drupal install folder (mydrupal/sites)
- Copy the sites folder from your old drupal install to the new (copy tempmydrupal/sites over to mydrupal/sites)
- Run the drupal update.php script (yoursite.com/update.php)
- put the site back online
- If it fails you have the original directly exactly as it was under temp/mydrupal so all you'd have to do is restore the databases and put that directory right back where it was if something went wrong.

So to summarize.  you temporarily renamed your old folder to some other name so you've lost NOTHING.  You put the new drupal version exactly where the old one used to be (so you don't have to mess with your domain configuration).  You copied over the site specific files (.htaccess, robots.txt, sites folder, files folder if it isn't under the sites folder).  You ran the update.php so the new drupal can make any required database updates to bring you up to the new version.  And done!

Hopefully I got it right (and apologies if not)

mrl586

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.0
  • MySQL version: 5.5.9
  • PHP version: 5.3.5
Re: Upgrading Drupal - best practices to protect CiviCRM
March 08, 2010, 09:29:20 pm
I upgrade my Drupal installation this way:
1. I backup my Drupal installation using Backup and Migrate module
2. I open Konsole and I take ssh connection to my server.
3. Next I move to Drupal directory via commandline (cd /path/to/drupal/)
4. I download newest Drupal via drush (drush dl)
5. I go to /path/to/drupal/drupal-6.xx and I remove sites directory on that folder
4. Next I go to /path/to/drupal and I copy content of drupal-6.xx to drupal folder (cp -rf ./drupal-6.xx/* ./)
5. I run command drush updatedb and I clean all drupal caches
6. I delete drupal-6.xx folder

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Upgrading Drupal - best practices to protect CiviCRM

This forum was archived on 2017-11-26.