Why Updating Moodle via CVS IS the better way to go ... PDF Print E-mail
User Rating: / 2
PoorBest 
Written by Ken Task   
Saturday, 17 July 2010 20:42
AddThis Social Bookmark Button
If you've added some additional mods/blocks/themes to Moodle, by far, the easiest way to upgrade is CVS.
The 'long way' requires one to either move or create some method of getting those add-ons into the new Moodle.
IMHO, easier to leave the Moodle in place and run CVS.  You might get more than you need, but it is an "easy button" when one compares the steps involved.

BEFORE doing anything such as this, BACKUP your Moodle - the directory at your web root AND do a mysql dump of the database!  DON'T IGNORE THIS! (author not responsible!!!!)

The first time one updates a Moodle instance via CVS one has to issue two commands:

cvs   -d:pserver:anonymous@us2.cvs.moodle.org:/cvsroot/moodle login;
cvs   -z3 -d:pserver:anonymous@us2.cvs.moodle.org:/cvsroot/moodle co -P -d   moodle -r MOODLE_19_WEEKLY moodle;

The first will prompt for a password.  Just press ENTER.

After it has completed, hit the admin directory of the Moodle:
http://[yoursite]/[yourmoodle]/admin/

That should begin the process and eventually you will be forced to login as an Admin level user to finish the update.

Once you've successfully done that, create a text file (we're going to make it an executable script to run via command line OR from Webmin as a button) called 'update'.
In the 'update' script, copy and paste the following:

echo 'moving version.php to .old';
mv version.php version.php.old;
echo 'updating via cvs ...';
cvs update -dP;
echo 'CVS update completed ...';
echo 'Setting permissions ...';
chown apache:apache * -R;
ls -l version.php;
fgrep '$release' version.php;
echo 'Now hit Admin Notifications of this Moodle to update the database.';
echo 'Done.';

To make 'update' executable: chmod u+x update [ENTER]

To run it from the command line as root user:
cd /var/www/html/[yourmoodleinstance] [ENTER]
./update [ENTER]

To run it as a button in Webmin:

Login to Webmin
Go to: Others -> Custom Commands -> Create a new custom command
In description box: CVS Update Moodle
Command: /var/www/html/[yourmoodledir]/update
Run in directory: /var/www/html/[yourmoodledir]/
Run As: root and check the box for 'Use user's environment'
Save the button

Now before trying the button, BACKUP your Moodle!

Remember that either way, the update is not complete until you step through the update in Moodle itself.
The update will be run when you hit admin in your Moodle.  It is important one does that as there could be
new options for you to set/consider.

If you have 'oodles of Moodles' … ie, more than one installation ... that has undergone an initial update via CVS, copy the 'update' script into each instances directory.  You need to make adjustments to your Webmin button then.
The button could take a directory argument before clicking the 'do it' button.

Please see Moodle.org's information concerning upgrading:
http://docs.moodle.org/en/Administrator_documentation#Installation_.26_Upgrading
http://docs.moodle.org/en/Upgrading
http://docs.moodle.org/en/Upgrading#Using_CVS
 
 
Total Views: 386