Friday, July 18, 2014

Executing a site upgrade from the command line (CLI)

After spending a lot of time upgrading moodle sites via the browser.  IE, making the changes to the code base/DB and then browsing the site home directory...I decided I would try calling the same file, upgrade.php, from the command line.

I am using WAMP 2.2.  After a little trial and error, I was able to kick off the upgrade from the command line, which is better for 2 reasons:
  • Its faster, a lot faster removing the browser from the upgrade equation
  • Sometimes, if the DB is real big, the browser will stop responding in the middle of the upgrade...leaving one wondering if it is still doing anything and requiring a re-load of the browser.
This is the command I executed from the command line.  I actually created a .bat file to save myself  retyping the same commands each time I wanted to kick off the upgrade.

My .bat contains two lines:

cd \wamp\bin\php\php5.3.13

php.exe c:\wamp\www\teststudent\admin\cli\upgrade.php

Note:  I had to un-comment extension = php.curl.dll in the php.ini file located in the wamp\bin\php\php5.3.13 path for this to work.  I also restarted the WAMP services after making the change to the php.ini file, forcing a re-read of the file.

No comments:

Post a Comment