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.
record_update
and has_updated
can be used to record and check whether an update has been done respectively.pdaterttils::check_version
function should be added to each update script. It checks the version of rogo in config/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.