Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Status
colourRed
titleRogo 6.5.0

Purpose

The upgrade scripts script (e.g. `/updates/version5upgrade.php`) have 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 an the upgrade script may be used to 'fix' content that is wrong in the database - update the content of a question(s) that has become corrupted or student answers that are incorrectly saveddue 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

...

  1. The files in the /updates/version5scripts/ directory gets automatically included when /updates/version5upgrade.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.
  2. Some actions such as transforming content into a different format should only be performed once. Because an update script may be run several times in a major release branch it is important that the transformation is not reapplied. To solve this (starting at Rogo 6.0) there is a new 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.
  3. From Rogo 6.1 this process has been replaced with the new updaterttilsSome actions such as transforming content into a different format should only be performed on a specific version of Rogo. updaterttils::check_version function which should be added to each update script. It checks the version of rogo in config/rogo.xml against the current installed version in config/config. inc.php. This stops upgrade scripts being run more that once on a version as before but and also stops upgrades being run when they are not required i.e. from a previous version.