Fixing VM Bugs with Subversion

In order to participate in the team effort to fix bugs and make enhancements to the current version of the VM module, it is necessary to download the latest version of VM and establish it as an active subversion project. This step-by-step guide will walk you through the process.

0. If you don't have a workspace on your own laptop or server, a space has been set up on Log on to storage and setup your own directory:

 $ ssh <username>
 storage1$: cd /usr/share/sahana_dev/
 storage1$: mkdir <username>

1. Download the phase2 release of Sahana from the Sri Lanka web site and put it in a folder named sahana-phase2. The command is:

 $ cvs -z3 co -P sahana-phase2

This will install Sahana in a directory named sahana-phase2. If you are not using storage1, this directory should go in your www directory or whatever directory is used by your web server.

2. Change into your sahana-phase2/mod directory and delete the vm directory. Then make a new vm directory and make it your working directory:

 $ rm -r vm
 $ mkdir vm
 $ cd vm

3. Check out the latest version of the VM module from the SVN repository on storage1 by using the following command:

 $ svn checkout svn+ssh://<username> .

OR If you use http authentication

 $ svn checkout --username ARG .

<username> - your user name
. - your current working directory

(NOTE: You may be prompted for your password 3 times. That's okay. Ignore the "kill signal 15" messages.)

4. Start up and configure Sahana by opening it in your web browser. For storage1 users, the URL is, where username is your own account name. For PC and Mac users, the URL would be http://localhost/~username/sahana-phase2/www. You must perform the following configuration steps. Sahana will guide you through these steps. Just keep reloading the Sahana home page.

  • Make the /tmp and /conf directories writeable. $ chmod 777 ../../www/tmp $ chmod 777 ../../conf
  • If you are using storage1, set up your Sahana database by inputting the following values in the Database Setup form:
   Database Host Port: localhost
   Database Name: sahana2_username_db
   Database User: sahana_admin
   Database password: Hint: if at first you don't succeed, Trishan will tell you.
  • If you are using your own Mac or PC, these values would be something like:
   Database Host Port: localhost
   Database Name: sahana_phase2
   Database User: root
   Database password: optional
  • Complete the Sahana initialization by filling in the Administrator Form. You can leave the Access Control field disabled.

5. After starting Sahana, complete the configuration by choosing a name for this Disaster and by setting up Google Maps. You can use the following Google map keys:

  For localhost: ABQIAAAAX9kFWCOVmh4o4cBea04nYRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTdqd-HvvYEQW6T7-qWDcvzm2E2yQ
  For storage1: ABQIAAAAX9kFWCOVmh4o4cBea04nYRTo-bu_OJIFy0Dp6biMmiFGRvqjRxQVdEdz6h5kJptD0hHcPIWgB6NEfg

If you need to get a new Google key, click on the following link: Google maps.

6. Import the VM tables into your instance of the Sahana database. The instructions for this step are contained in the README_RC1.txt file in the vm directory.

  • Complete the Sahana initialization by filling in the Administrator Form. You can leave the Access Control field disabled.

7. Download Jonathan's Database Dump of US GPS Data table into vm/ins folder. Then follow the same instructions in README_RC1.txt but replacing the name db_setup.sql with USCitiesGPS.sql. You can directly download the USCitiesGPS.sql file into your vm/inc/ folder with the following command while in the vm/inc folder type:

   $ wget '' 

8. Finally, now you are ready to track down the bugs and/or code the feature modifications. When you are done fixing a bug or making a modification, you will need to commit your code to the repository on storage1:

 $ svn commit

To update your local copy with the latest from the storage1 repository:

 $ svn update

You can refer the How to use Subversion (Guide and Resources) for more detailed instructions and resources on using Subversion.

9. Coding conventions: Don't delete the original code. Just comment it out and add a PHP comment with your name or initials and the current date and brief description of how you have modified the code. Here's an example:

  // RAM -- 11/26/2006 -- Adding an if clause to make the call to _display_volunteers() 
  //  conditional on there being >0 volunteers.
  if (get_volunteer_count($project_id_param) != 0)
       _display_volunteers($proj_id);   // Display     a list of volunteers

Once you've finished, update the VM module RC1 task list.