diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-05 19:14:48 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-05 19:14:48 +0000 |
commit | ff31226fdeb972aac2f37f0098240cb366a9bb26 (patch) | |
tree | 1f0caa75c9a340cf28ce9a81a4cbe3230d13abf3 /actions/admin/plugins/simple_update_states.php | |
parent | 81ffac29fabc175eebdbf95578da046f4f00611b (diff) | |
download | elgg-ff31226fdeb972aac2f37f0098240cb366a9bb26.tar.gz elgg-ff31226fdeb972aac2f37f0098240cb366a9bb26.tar.bz2 |
Merged 18_new_admin branch to trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@5977 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/admin/plugins/simple_update_states.php')
-rw-r--r-- | actions/admin/plugins/simple_update_states.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php new file mode 100644 index 000000000..197f183f9 --- /dev/null +++ b/actions/admin/plugins/simple_update_states.php @@ -0,0 +1,41 @@ +<?php +/** + * Elgg administration simple plugin bulk enable / disable + * + * Shows an alphabetical list of "simple" plugins. + * + * @package Elgg + * @subpackage Core + * @author Curverider Ltd + * @link http://elgg.org/ + */ + +$installed_plugins = get_installed_plugins(); +$enabled_plugins = get_input('enabled_plugins', array()); + +$success = TRUE; + +foreach ($installed_plugins as $plugin => $info) { + // this is only for simple plugins. + if (!isset($info['manifest']['admin_interface']) || $info['manifest']['admin_interface'] != 'simple') { + continue; + } + + $plugin_enabled = is_plugin_enabled($plugin); + + // only effect changes to plugins not already in that state. + if ($plugin_enabled && !in_array($plugin, $enabled_plugins)) { + $success = $success && disable_plugin($plugin); + } elseif (!$plugin_enabled && in_array($plugin, $enabled_plugins)) { + $success = $success && enable_plugin($plugin); + } +} + +if ($success) { + elgg_delete_admin_notice('first_installation_plugin_reminder'); + system_message(elgg_echo('admin:plugins:simple_simple_success')); +} else { + register_error(elgg_echo('admins:plugins:simple_simple_fail')); +} + +forward($_SERVER['HTTP_REFERER']);
\ No newline at end of file |