Upgrading Drupal distributions, technically referred to as installation profiles, can be tricky. If you aren't using Drupal Core, but rather a distribution of it, it's not possible to follow standard processes for upgrading Drupal core and contributed modules. You must upgrade the distribution as a whole.
In this article, we'll be working with the Web Experience Toolkit (wetkit) as the example distribution.
- For revision control, Git is being used to track code changes.
- Drush is installed and is properly configured with site aliases.
- Switch to your Web directory and make sure your working tree is clean.
- cd $(drush dd @site); git status
- Note any commits made to the distro since it was last upgraded. These will have to be reapplied (cherry-picked in git-speak) after the upgrade unless they were explicitly added to the distro in the latest release. Find them with this command.
- git log profiles/wetkit/
- Make sure that you read and understand any distro-specific information on upgrading it. In this example, the documentation is available over at Release Cycle / Updates.
- This is a workaround until Drush up should update contrib profiles as well is fixed. Download the distro with the following command. For the version number, use the version that was released immediately after the version that you currently have installed. For example, if you have 7.x-1.4, you need to download 7.x-1.5. If you're multiple versions behind, you'll need to repeat these instructions multiple times. Jumping more than one release ahead could cause problems.
- Unpack it.
- tar zxvf /tmp/wetkit-7.x-Y.Z-core.tar.gz --directory /tmp
- Move your sites folder out of the way so that it won't be overwritten. It's necessary to do this as the administrator to maintain permissions on the files directory.
- sudo mv sites /tmp
- Copy the new release's files into your Web dir. Don't copy core's Git ignore file; keep ours. This is a workaround for Rename core .gitignore file to example.gitignore and add explanatory comments.
- cp -r /tmp/wetkit-7.x-Y.Z/.htaccess /tmp/wetkit-7.x-Y.Z/* .
- Replace the new default sites dir with our own.
- rm -rf sites
- sudo mv /tmp/sites .
- Remove the distro-specific Git ignore files, as they'll cause us to ignore files we shouldn't.
- rm $(find profiles/wetkit -name ".gitignore")
- Stage all of the changed files.
- git add --all
- Commit the upgrade with a comment like, "Issue #123: Upgraded the WxT distro from release 7.x-A.B to 7.x-A.C."
- git commit
Cherry-pick each of the commits that you noted in the first step. Ideally, these are upstream patches that you either found or posted yourself while working on the distro. For each commit message, use something like "Issue #567: Applied patch from https://www.drupal.org/node/1417630#comment-6810906." so you'll know if you'll be need to re-apply it again, or if it's been committed (and you no longer need to worry about it).
- git --edit cherry-pick COMMIT_ID_1
- git --edit cherry pick COMMIT_ID_2
- Update the database schema.
- drush updb
- Clear all of the application caches.
- drush cc all
- Test the local site to ensure everything is working.
- Whenever we override the distro's module versions in sites/all/modules/contrib (this should be an extremely rare occurence, if ever), we should set up Profile Status Check. In fact, it probably wouldn't hurt to include this module in all of the official distributions.