- Allow the update script to include a PHP script too. The PHP script, called

db.update.$num.php, may contain 2 functions  db_update_pre() and
  db_update_post()  which are run before(pre) and after(post) the SQL file is
  applied.  If the php script doesn't exist, the behaviour of the update script
  is unchanged.
This commit is contained in:
dave 2007-11-16 21:42:45 +00:00
parent 40fe6cb88c
commit 3904e2d9d8

View File

@ -55,6 +55,15 @@ if($dbcodeversion && $dbdbversion)
for($ver=$dbdbversion+1;$ver<=$dbcodeversion;$ver++)
{
if(file_exists("db.update.$ver.php"))
{
include("db.update.$ver.php");
}
if(is_callable("db_update_pre")) {
echo "db.update.$ver.php::db_update_pre() exists - running...\n";
call_user_func("db_update_pre");
echo "db.update.$ver.php::db_update_pre() done.\n";
}
if(file_exists("db.update.$ver.sql"))
{
echo "db.update.$ver.sql detected - running...\n";
@ -64,7 +73,12 @@ if($dbcodeversion && $dbdbversion)
}
else
{
echo "Version $ver update file not found - skipping over\n";
echo "Version $ver SQL update file not found - skipping over\n";
}
if(is_callable("db_update_post")) {
echo "db.update.$ver.php::db_update_post() exists - running...\n";
call_user_func("db_update_post");
echo "db.update.$ver.php::db_update_post() done.\n";
}
}
echo "\nAll done - updating new DB version to $dbcodeversion\n";