From ff2d81b7c3b75e548766fb8a0ae370cbb2e39bf5 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 21 Jan 2010 13:03:58 -0800 Subject: Convert the slideshow module to use the new check environment and pre_deactivate api methods. --- modules/slideshow/helpers/slideshow_installer.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/slideshow/helpers/slideshow_installer.php') diff --git a/modules/slideshow/helpers/slideshow_installer.php b/modules/slideshow/helpers/slideshow_installer.php index 03f3332c..319e2e79 100644 --- a/modules/slideshow/helpers/slideshow_installer.php +++ b/modules/slideshow/helpers/slideshow_installer.php @@ -33,4 +33,12 @@ class slideshow_installer { static function deactivate() { site_status::clear("slideshow_needs_rss"); } + + static function check_environment() { + $messages = array(); + if (!module::is_active("rss")) { + $messages["warn"][] = t("The Slideshow module requires the RSS module."); + } + return $messages; + } } -- cgit v1.2.3 From df313cac567bee77f5a73308381fe67dcac9b92c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 22 Jan 2010 12:30:17 -0800 Subject: Change the check_environment method in the module helper and the module installers to can_activate to reflect that it is doing more than just checking the environment. --- modules/gallery/controllers/admin_modules.php | 2 +- modules/gallery/helpers/module.php | 8 ++++---- modules/slideshow/helpers/slideshow_installer.php | 2 +- modules/user/helpers/user_installer.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'modules/slideshow/helpers/slideshow_installer.php') diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index 46defbef..a2168280 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -42,7 +42,7 @@ class Admin_Modules_Controller extends Admin_Controller { if ($info->active && !$desired && module::is_active($module_name)) { $messages = array_merge($messages, module::can_deactivate($module_name)); } else if (!$info->active && $desired && !module::is_active($module_name)) { - $messages = array_merge($messages, module::check_environment($module_name)); + $messages = array_merge($messages, module::can_activate($module_name)); } } diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 595f600b..f680ff6a 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -120,17 +120,17 @@ class module_Core { } /** - * Check that the module can be installed. (i.e. all the prerequistes exist) + * Check that the module can be activated. (i.e. all the prerequistes exist) * @param string $module_name * @return array an array of warning or error messages to be displayed */ - static function check_environment($module_name) { + static function can_activate($module_name) { module::_add_to_path($module_name); $messages = array(); $installer_class = "{$module_name}_installer"; - if (method_exists($installer_class, "check_environment")) { - $messages = call_user_func(array($installer_class, "check_environment")); + if (method_exists($installer_class, "can_activate")) { + $messages = call_user_func(array($installer_class, "can_activate")); } // Remove it from the active path diff --git a/modules/slideshow/helpers/slideshow_installer.php b/modules/slideshow/helpers/slideshow_installer.php index 319e2e79..8d612f3e 100644 --- a/modules/slideshow/helpers/slideshow_installer.php +++ b/modules/slideshow/helpers/slideshow_installer.php @@ -34,7 +34,7 @@ class slideshow_installer { site_status::clear("slideshow_needs_rss"); } - static function check_environment() { + static function can_activate() { $messages = array(); if (!module::is_active("rss")) { $messages["warn"][] = t("The Slideshow module requires the RSS module."); diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index 3882f5f2..38f8020b 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class user_installer { - static function check_environment() { + static function can_activate() { return array("warn" => array(IdentityProvider::confirmation_message())); } -- cgit v1.2.3