mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 03:19:13 -04:00
Refactor the install/upgrade code to be more flexible.
Add xxx_installer::upgrade($version) method so that upgrade stanzas are separate from install stanzas. In the old code, to do an upgrade meant that you had to re-evolve everything from the initial install because we'd step through each version's changes. But what we really want is for the initial install to start off in the perfect initial state, and the upgrades to do the work behind the scenes. So now the install() function gets things set up properly the first time, and the upgrade() function does any work to catch you up to the latest code. See gallery_installer.php for a good example.
This commit is contained in:
@@ -45,7 +45,11 @@ class Admin_Modules_Controller extends Admin_Controller {
|
||||
} else if (!$info->active && $desired && !module::is_active($module_name)) {
|
||||
$changes->activate[] = $module_name;
|
||||
$activated_names[] = $info->name;
|
||||
module::install($module_name);
|
||||
if (module::is_installed($module_name)) {
|
||||
module::upgrade($module_name);
|
||||
} else {
|
||||
module::install($module_name);
|
||||
}
|
||||
module::activate($module_name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user