GMC:Upgrading Drupal - Gallery Codex
Personal tools

GMC:Upgrading Drupal

From Gallery Codex

Drupal is managed in Subversion on GMC. We've made modifications to the Drupal code and we want to keep them through upgrades, so when a new version of Drupal is released we want to make sure that we have a controlled upgrade process. The way we do this is by maintaining a vendor branch for the code from Drupal, and a trunk branch that contains the version of Drupal we're using with our modifications. When a new release of Drupal comes out, we commit that to the vendor branch, then use subversion to merge it into the trunk code. All of this is done on the staging server -- once that works properly we commit the changes to subversion, go to the production server and update it from subversion.

Because this is a public wiki, I've used fake paths.

Here are the steps:

  1. cd /var/www/test.gallery2.org One level below the vendor branch
  2. wget http://drupal.org/files/projects/drupal-5.#.tar.gz
  3. cd vendor
  4. find . -name .svn -prune -o -type f -print | xargs rm Remove all existing files from the vendor branch
  5. tar --strip-components=1 -xzf ../drupal-5.#.tar.gz --strip-components=1 removes the first directory from all paths. now use use "svn st" and "svn diff" to assure yourself that everything looks ok
  6. svn st Any files marked with (!) were deleted in this new release. Anything marked with (?) are new files. svn add and svn remove files as necessary.
  7. svn commit -m "Update to Drupal 5.#" svn returns "YYY" as the change list id at this point the vendor branch is up to date. Now we can begin merging
  8. cd /var/www/test.gallery2.org/trunk
  9. svn st Make sure that there's nothing uncommitted in trunk. Deal with anything that's hanging around.
  10. cd /var/www/test.gallery2.org
  11. svn merge -c YYY vendor trunk This merges all Drupal changes into our trunk it probably generates some conflicts. For each conflict, edit the file, resolve the conflict (they are often just changed numbers in $Id$ tags) and then do "svn resolved" on each conflicted file.
  12. svn diff Take a look at the diffs and make sure they look as expected. Test the dev site to make sure that the code around these diffs is ok.
  13. svn commit -m "Update to Drupal 5.#" Now the code on the dev site is up to date
  14. edit update.php and set $access_check=FALSE;
  15. Browse to update.php and run all updates
  16. svn revert update.php
  17. cd /var/www/galleryproject.org
  18. svn up Now the code on the live site is up to date.
  19. edit update.php and set $access_check=FALSE;
  20. Browse to update.php and run all updates
  21. svn revert update.php
  22. Notify the core team about what changed