Updating a Drupal module in a subversion integrated filesystem using rsync
Version control is an essential tool when it comes to maintaining your code and properly tracking filesystem changes. In this quick tutorial, I’ll show you how to update a Drupal module in a subversion integrated environment using rsync. Since simply copying the contents of a new module update on top of your current directory structure is a bad idea (since it will NOT account for file deletions), rsync is a great solution for syncing module update changes. NOTE: it is a bad idea to update a module in a production environment without proper testing; this code assumes you are working in a development environment.
The first step is to download the latest (and in most cases, stable) package for the module you’d like to update to a directory outside your drupal path. For my Drupal installations, I browse to the Available updates page (admin/reports/updates) and copy the URL from this page. Next I go to my shell, use wget to fetch the package to my home directory, and unpack the file:
Now you can run the rsync command to apply the filesystem changes to your Drupal module directory. You’ll have to update the paths listed below to match your filesystem and Drupal installation.
If executed properly, you can change directory to the module you are trying to update and run an “svn stat” command to see what has been updated. NOTE: the below output is simulated to show common svn status changes.
At this point you should see a list of all the files that have changed with this module update. You can now run the update.php script in your development environment and verify the changes are working properly. If everything is working properly, you can commit the module update changes…
Now you can safely deploy the module changes to your production environment (svn update), run the update.php script, and ensure everything is working properly.
Note: in Mac OSX: