diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-06 03:58:37 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-06 03:58:37 +0000 |
commit | cf27982466a79e0e73be2b6911d2312cdf22c147 (patch) | |
tree | 26a9f9767a95ab93ef59e52b14c2ae5b2c4931ae /core/controllers | |
parent | 2738d4b6a6910575059e4e1eaa7192ab2a1369a5 (diff) |
When uninstalling the core, uninstall all the other modules first.
Otherwise, when you reinstall the other module's tables are still
hanging around and interfere with their install.
Diffstat (limited to 'core/controllers')
-rw-r--r-- | core/controllers/welcome.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 76093d75..53e5aaa4 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -38,13 +38,22 @@ class Welcome_Controller extends Template_Controller { $this->_create_directories(); } - function install($module) { - call_user_func(array("{$module}_installer", "install")); + function install($module_name) { + call_user_func(array("{$module_name}_installer", "install")); url::redirect("welcome"); } - function uninstall($module) { - call_user_func(array("{$module}_installer", "uninstall")); + function uninstall($module_name) { + if ($module_name == "core") { + // We have to uninstall all other modules first, else their tables, etc don't + // get cleaned up. + foreach (ORM::factory("module")->find_all() as $module) { + if ($module->name != "core" && $module->version) { + call_user_func(array("{$module->name}_installer", "uninstall")); + } + } + } + call_user_func(array("{$module_name}_installer", "uninstall")); url::redirect("welcome"); } |