Drupal Updates

You can now find a drupal upgrade script on github and for drupal modules installation! Beware that this script was written for my site setup and works for me, maybe not for you, as you have other site setups, etc. I wrote it with respect to other setups though, but will never guarantee that :) If you are reluctant, try drush instead - though drush screwed my page up at least :/

Recently, I needed to upgrade my drupal installation and was quite surprised by the complexity of a drupal system update. Therefore, I sum up the steps necessary here, to simplify the process next time.

  1. Put site into maintenance mode (switch to garland?)
  2. Backup database (mysql) -> use phpmyadmin (save in dedicated directory) with a template like nesono.com_%Y-%m-%d
  3. Unpack drupal in /var/ (will be e.g. in directory /var/drupal-6.11)
  4. Copy stuff (check settings.php vs default.settings.php first!)
  5. cp /var/www/sites/default/settings.php /var/drupal-6.11/sites/default/
  6. cp -r /var/www/tmp /var/drupal-6.11/
  7. cp -r /var/www/sites/default/files /var/drupal-6.11/sites/default/
  8. cp -r /var/www/sites/all/modules /var/drupal-6.11/sites/all/
  9. cp -r /var/www/sites/all/themes /var/drupal-6.11/sites/all/
  10. cp -r /var/www/sites/all/libraries /var/drupal-6.11/sites/all
  11. chown -R www-data:www-data /var/drupal-6.11
  12. stop apache
  13. Move the new drupal directory to the document root
  14. rm -rf www.bup
  15. mv www www.bup
  16. mv drupal-6.11 /var/www
  17. Run update.php within document root
  18. start apache
  19. http://www.nesono.com/update.php
  20. Put site back online (deactivate maintenance mode again)

As a shortcut for steps 5 to 7.1, you can copy & paste the following line into your terminal:

/etc/init.d/apache2 stop && rm -rf www.bup && mv www www.bup && mv drupal-6.11 www && /etc/init.d/apache2 start

And boom! That’s it.
Cheers, iss