This space is archived
For current information please use the current ExamSys documentation
Upgrade Scripts
ROGO 6.5.0
Purpose
The upgrade script (e.g. `/updates/upgrade.php`) has two main purposes:
1) alter the database structure to match the new code
2) alter/add settings into `/config/config.inc.php` or to the config database table.
Sometimes the upgrade script may be used to 'fix' content that is wrong in the database due to a historic bug. Institution specifc data issues should never be fixed via this script. The institution should write their own patch.
The overall principle of the upgrade script is to take any sub-version of Rogo (where possible) and upgrade to the latest. To do this it will actively look at the database and configuration file and determine what changes are necessary. This allows for the script to be safely run more than once and not get too many fields add to the database.
Principles
- The files in the /updates/scripts/ directory gets automatically included when /updates/upgrade.php is run. Each separate update check is in its own file. The reason for this is to avoid conflicts when working in a large team when multiple programmers may all need to change the main update script. This approach solves the conflict issue because separate files are used.
- To stop an update being run more than once there is a database tabled called sys_updates. Two functionsÂ
record_update
 andÂhas_updatedÂ
can be used to record and check whether an update has been done respectively. - Some actions such as transforming content into a different format should only be performed on a specific version of Rogo. u
pdaterttils::check_version
function should be added to each update script. It checks the version of rogo inconfig/rogo.xml
against the current installed version. This stops upgrade scripts being run more that once on a version and also stops upgrades being run when they are not required.