Upgrade Function

Upgrade Function

As with the two previous functions, the upgrade works in a similar manner. The function must be located in your library.php file and be called my_module__upgrade() - where (you know the drill!) the my_module part is the name of your module folder.

This function is called automatically by the Form Tools core on the Modules listing page. If the module version in the module.php file is different from the value stored in the database, it will highlight the module row and replace the "SELECT" link with an "UPGRADE" link. When clicked, it will call your upgrade function (if defined).

Your upgrade function should look like this:

function my_module__upgrade($old_version, $new_version)
{
  // execute whatever upgrade code you need to do here based on
  // the two parameters
}
Edit Page