From cf27982466a79e0e73be2b6911d2312cdf22c147 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 6 Nov 2008 03:58:37 +0000 Subject: 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. --- core/controllers/welcome.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'core/controllers') 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"); } -- cgit v1.2.3