# HG changeset patch # User Dan # Date 1202820256 18000 # Node ID 322fa0c91303122164969c4c070529944058bd3a # Parent b76ebe22954868c1591d3a0fa97763236e609c1e Fixed version-set on migration code (see the comments in the source for why) and added post-upgrade hooks. diff -r b76ebe229548 -r 322fa0c91303 install/schemas/upgrade/migration/1.0-1.1.php --- a/install/schemas/upgrade/migration/1.0-1.1.php Tue Feb 12 07:38:52 2008 -0500 +++ b/install/schemas/upgrade/migration/1.0-1.1.php Tue Feb 12 07:44:16 2008 -0500 @@ -37,7 +37,13 @@ $lang_local->import($lang_dir . "user.json"); $lang_local->import($lang_dir . "admin.json"); - setConfig('enano_version', installer_enano_version()); + // This doesn't set to installer_enano_version() because it only + // migrates the database from 1.0.x to 1.1.x status and runs the + // core logic required to transform a 1.0.x installation into + // a 1.1.x installation. Thus, when upgrading, the upgrade script + // still needs to run all later upgrade schema files in addition + // to this migration code. + setConfig('enano_version', '1.1.1'); return true; } diff -r b76ebe229548 -r 322fa0c91303 install/upgrade.php --- a/install/upgrade.php Tue Feb 12 07:38:52 2008 -0500 +++ b/install/upgrade.php Tue Feb 12 07:44:16 2008 -0500 @@ -234,6 +234,19 @@ if ( !$db->sql_query($sql) ) $db->_die(); } + + // Is there an additional script (logic) to be run after the schema? + $postscript = ENANO_ROOT . "/install/schemas/upgrade/{$verset[0]}-{$verset[1]}.php"; + if ( file_exists($postscript) ) + @include($postscript); + + // The advantage of calling setConfig on the system version here? + // Simple. If the upgrade fails, it will pick up from the last + // version, not try to start again from the beginning. This will + // still cause errors in most cases though. Eventually we probably + // need some sort of query-numbering system that tracks in-progress + // upgrades. + setConfig('enano_version', $verset[1]); } echo '

All done!

';