From 58b66643c1921706d764b2bb1ea4729519ca31f8 Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Sun, 2 Oct 2011 11:18:55 -0700 Subject: Fixes #3915. Added ElggPlugin->getFriendlyName() to check for manifest->getName() first, then for plugin ID. Added better descriptions for plugin activation errors. --- actions/admin/plugins/activate.php | 4 +++- actions/admin/plugins/activate_all.php | 4 +++- actions/admin/plugins/deactivate.php | 4 +++- actions/admin/plugins/deactivate_all.php | 4 +++- actions/admin/plugins/set_priority.php | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-) (limited to 'actions/admin/plugins') diff --git a/actions/admin/plugins/activate.php b/actions/admin/plugins/activate.php index 0049878e3..224b5a2ae 100644 --- a/actions/admin/plugins/activate.php +++ b/actions/admin/plugins/activate.php @@ -29,7 +29,9 @@ foreach ($plugin_guids as $guid) { if ($plugin->activate()) { $activated_guids[] = $guid; } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } diff --git a/actions/admin/plugins/activate_all.php b/actions/admin/plugins/activate_all.php index 19eb82142..19c142346 100644 --- a/actions/admin/plugins/activate_all.php +++ b/actions/admin/plugins/activate_all.php @@ -18,7 +18,9 @@ foreach ($guids as $guid) { if ($plugin->activate()) { //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:activate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } } diff --git a/actions/admin/plugins/deactivate.php b/actions/admin/plugins/deactivate.php index f5eca3aaa..2ce796eff 100644 --- a/actions/admin/plugins/deactivate.php +++ b/actions/admin/plugins/deactivate.php @@ -28,7 +28,9 @@ foreach ($plugin_guids as $guid) { if ($plugin->deactivate()) { //system_message(elgg_echo('admin:plugins:deactivate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } diff --git a/actions/admin/plugins/deactivate_all.php b/actions/admin/plugins/deactivate_all.php index 436a3ad30..479e9c607 100644 --- a/actions/admin/plugins/deactivate_all.php +++ b/actions/admin/plugins/deactivate_all.php @@ -18,7 +18,9 @@ foreach ($guids as $guid) { if ($plugin->deactivate()) { //system_message(elgg_echo('admin:plugins:activate:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:deactivate:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:deactivate:no_with_msg' : 'admin:plugins:deactivate:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } } } diff --git a/actions/admin/plugins/set_priority.php b/actions/admin/plugins/set_priority.php index 1f8bc24af..79b1c4c53 100644 --- a/actions/admin/plugins/set_priority.php +++ b/actions/admin/plugins/set_priority.php @@ -26,7 +26,9 @@ if (!($plugin instanceof ElggPlugin)) { if ($plugin->setPriority($priority)) { //system_message(elgg_echo('admin:plugins:set_priority:yes', array($plugin->getManifest()->getName()))); } else { - register_error(elgg_echo('admin:plugins:set_priority:no', array($plugin->getManifest()->getName()))); + $msg = $plugin->getError(); + $string = ($msg) ? 'admin:plugins:set_priority:no_with_msg' : 'admin:plugins:set_priority:no'; + register_error(elgg_echo($string, array($plugin->getFriendlyName(), $plugin->getError()))); } // don't regenerate the simplecache because the plugin won't be -- cgit v1.2.3 From 96604b6836edc0ee2f9bfc58fdbaedf19a6f099c Mon Sep 17 00:00:00 2001 From: Brett Profitt Date: Thu, 13 Oct 2011 22:08:26 -0700 Subject: Fixes #3917. Removed uses of admin interface in manifests. Removed related code. --- actions/admin/plugins/simple_update_states.php | 48 -------------------------- documentation/examples/plugins/manifest.xml | 4 --- engine/classes/ElggPluginManifest.php | 18 ---------- engine/classes/ElggPluginManifestParser18.php | 3 +- engine/lib/admin.php | 2 -- engine/tests/api/plugins.php | 5 --- engine/tests/test_files/plugin_18/manifest.xml | 1 - languages/en.php | 5 --- mod/blog/manifest.xml | 1 - mod/bookmarks/manifest.xml | 1 - mod/categories/manifest.xml | 1 - mod/custom_index/manifest.xml | 1 - mod/dashboard/manifest.xml | 3 +- mod/developers/manifest.xml | 3 -- mod/diagnostics/manifest.xml | 1 - mod/embed/manifest.xml | 1 - mod/externalpages/manifest.xml | 1 - mod/file/manifest.xml | 1 - mod/garbagecollector/manifest.xml | 1 - mod/groups/manifest.xml | 1 - mod/htmlawed/manifest.xml | 1 - mod/invitefriends/manifest.xml | 1 - mod/likes/manifest.xml | 3 +- mod/logbrowser/manifest.xml | 1 - mod/logrotate/manifest.xml | 1 - mod/members/manifest.xml | 3 +- mod/messageboard/manifest.xml | 1 - mod/messages/manifest.xml | 1 - mod/notifications/manifest.xml | 1 - mod/pages/manifest.xml | 1 - mod/profile/manifest.xml | 1 - mod/reportedcontent/manifest.xml | 1 - mod/search/manifest.xml | 1 - mod/tagcloud/manifest.xml | 1 - mod/thewire/manifest.xml | 1 - mod/tinymce/manifest.xml | 1 - mod/twitter/manifest.xml | 1 - mod/uservalidationbyemail/manifest.xml | 1 - mod/zaudio/manifest.xml | 1 - 39 files changed, 4 insertions(+), 121 deletions(-) delete mode 100644 actions/admin/plugins/simple_update_states.php (limited to 'actions/admin/plugins') diff --git a/actions/admin/plugins/simple_update_states.php b/actions/admin/plugins/simple_update_states.php deleted file mode 100644 index 7601013a7..000000000 --- a/actions/admin/plugins/simple_update_states.php +++ /dev/null @@ -1,48 +0,0 @@ -getManifest()->getAdminInterface() != 'simple') { - continue; - } - - // only effect changes to plugins not already in that state. - if ($plugin->isActive() && !in_array($plugin->guid, $active_plugin_guids)) { - $success = $success && $plugin->deactivate(); - } elseif (!$plugin->isActive() && in_array($plugin->guid, $active_plugin_guids)) { - $success = $success && $plugin->activate(); - } -} - -if ($success) { - //system_message(elgg_echo('admin:plugins:simple_simple_success')); -} else { - register_error(elgg_echo('admin:plugins:simple_simple_fail')); -} - -// don't regenerate the simplecache because the plugin won't be -// loaded until next run. Just invalidate and let it regnerate as needed -elgg_invalidate_simplecache(); -elgg_filepath_cache_reset(); - -forward(REFERER); \ No newline at end of file diff --git a/documentation/examples/plugins/manifest.xml b/documentation/examples/plugins/manifest.xml index 1602a7358..2a8a2bd5c 100644 --- a/documentation/examples/plugins/manifest.xml +++ b/documentation/examples/plugins/manifest.xml @@ -32,10 +32,6 @@ admin api - setup_function - teardown_function - simple - php_extension gd diff --git a/engine/classes/ElggPluginManifest.php b/engine/classes/ElggPluginManifest.php index 0e47f388d..eacc16455 100644 --- a/engine/classes/ElggPluginManifest.php +++ b/engine/classes/ElggPluginManifest.php @@ -552,24 +552,6 @@ class ElggPluginManifest { return $normalized; } - /** - * Returns the admin interface to use. - * - * @return string simple or advanced - */ - public function getAdminInterface() { - $interface = $this->parser->getAttribute('admin_interface'); - - switch ($interface) { - case 'simple': - case 'advanced': - return $interface; - - default: - return 'advanced'; - } - } - /** * Returns the admin interface to use. * diff --git a/engine/classes/ElggPluginManifestParser18.php b/engine/classes/ElggPluginManifestParser18.php index db8b3dc6a..554e28c02 100644 --- a/engine/classes/ElggPluginManifestParser18.php +++ b/engine/classes/ElggPluginManifestParser18.php @@ -16,7 +16,7 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser { 'name', 'author', 'version', 'blurb', 'description', 'website', 'copyright', 'license', 'requires', 'suggests', 'screenshot', 'category', 'conflicts', 'provides', - 'admin_interface', 'activate_on_install' + 'activate_on_install' ); /** @@ -46,7 +46,6 @@ class ElggPluginManifestParser18 extends ElggPluginManifestParser { case 'website': case 'copyright': case 'license': - case 'admin_interface': case 'activate_on_install': $parsed[$element->name] = $element->content; break; diff --git a/engine/lib/admin.php b/engine/lib/admin.php index d12baed50..ae6429baf 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -230,8 +230,6 @@ function admin_init() { elgg_register_action('admin/delete_admin_notice', '', 'admin'); - elgg_register_action('admin/plugins/simple_update_states', '', 'admin'); - elgg_register_action('profile/fields/reset', '', 'admin'); elgg_register_action('profile/fields/add', '', 'admin'); elgg_register_action('profile/fields/edit', '', 'admin'); diff --git a/engine/tests/api/plugins.php b/engine/tests/api/plugins.php index 72092b688..8f5f5dd1e 100644 --- a/engine/tests/api/plugins.php +++ b/engine/tests/api/plugins.php @@ -105,7 +105,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { array('type' => 'plugin', 'name' => 'facebook_connect', 'version' => 1.0), ), - 'admin_interface' => 'simple', 'activate_on_install' => true ); @@ -265,10 +264,6 @@ class ElggCorePluginsAPITest extends ElggCoreUnitTest { $this->assertEqual($this->manifest17->getConflicts(), array()); } - public function testElggPluginManifestGetAdminInterface() { - $this->assertEqual($this->manifest18->getAdminInterface(), 'simple'); - } - public function testElggPluginManifestGetActivateOnInstall() { $this->assertEqual($this->manifest18->getActivateOnInstall(), true); } diff --git a/engine/tests/test_files/plugin_18/manifest.xml b/engine/tests/test_files/plugin_18/manifest.xml index 23f0fa0bf..445a41c2e 100644 --- a/engine/tests/test_files/plugin_18/manifest.xml +++ b/engine/tests/test_files/plugin_18/manifest.xml @@ -34,7 +34,6 @@ ServiceAPI - simple true diff --git a/languages/en.php b/languages/en.php index 9967bc34d..67e447901 100644 --- a/languages/en.php +++ b/languages/en.php @@ -686,12 +686,7 @@ $english = array( 'admin:plugins:plugin_website' => 'Plugin website', 'admin:plugins:author' => '%s', 'admin:plugins:version' => 'Version %s', - 'admin:plugins:simple' => 'Simple', - 'admin:plugins:advanced' => 'Advanced', 'admin:plugin_settings' => 'Plugin Settings', - 'admin:plugins:simple_simple_fail' => 'Could not save settings.', - 'admin:plugins:simple_simple_success' => 'Settings saved.', - 'admin:plugins:simple:cannot_activate' => 'Cannot activate this plugin. Check the advanced plugin admin area for more information.', 'admin:plugins:warning:unmet_dependencies_active' => 'This plugin is active but has unmet dependencies. You may encounter problems. See "more info" below for details.', 'admin:plugins:dependencies:type' => 'Type', diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml index 991462060..dfbd7a1a6 100644 --- a/mod/blog/manifest.xml +++ b/mod/blog/manifest.xml @@ -15,6 +15,5 @@ elgg_version 2010030101 - simple true diff --git a/mod/bookmarks/manifest.xml b/mod/bookmarks/manifest.xml index 72e9af9b0..24969b837 100644 --- a/mod/bookmarks/manifest.xml +++ b/mod/bookmarks/manifest.xml @@ -16,5 +16,4 @@ 2010030101 true - simple diff --git a/mod/categories/manifest.xml b/mod/categories/manifest.xml index 15d7192c1..db6f0324f 100644 --- a/mod/categories/manifest.xml +++ b/mod/categories/manifest.xml @@ -14,5 +14,4 @@ elgg_version 2010030101 - advanced diff --git a/mod/custom_index/manifest.xml b/mod/custom_index/manifest.xml index 7bb2a2543..dd00f2c49 100644 --- a/mod/custom_index/manifest.xml +++ b/mod/custom_index/manifest.xml @@ -12,5 +12,4 @@ elgg_version 2009030702 - advanced diff --git a/mod/dashboard/manifest.xml b/mod/dashboard/manifest.xml index b5e9cff2e..7096fc86a 100644 --- a/mod/dashboard/manifest.xml +++ b/mod/dashboard/manifest.xml @@ -12,5 +12,4 @@ elgg_version 2010030101 - advanced - \ No newline at end of file + diff --git a/mod/developers/manifest.xml b/mod/developers/manifest.xml index 4a7ed82bd..25840e164 100644 --- a/mod/developers/manifest.xml +++ b/mod/developers/manifest.xml @@ -15,7 +15,4 @@ elgg_version 2009030802 - - advanced - diff --git a/mod/diagnostics/manifest.xml b/mod/diagnostics/manifest.xml index e85b19aef..5ebd7cf55 100644 --- a/mod/diagnostics/manifest.xml +++ b/mod/diagnostics/manifest.xml @@ -14,5 +14,4 @@ elgg_version 2010030101 - advanced diff --git a/mod/embed/manifest.xml b/mod/embed/manifest.xml index 02c012330..27e9b9ada 100644 --- a/mod/embed/manifest.xml +++ b/mod/embed/manifest.xml @@ -18,5 +18,4 @@ file true - advanced diff --git a/mod/externalpages/manifest.xml b/mod/externalpages/manifest.xml index 32528585d..4064ea602 100644 --- a/mod/externalpages/manifest.xml +++ b/mod/externalpages/manifest.xml @@ -12,5 +12,4 @@ elgg_version 2010030101 - advanced diff --git a/mod/file/manifest.xml b/mod/file/manifest.xml index aac9c3f6b..8a80e38dc 100644 --- a/mod/file/manifest.xml +++ b/mod/file/manifest.xml @@ -14,6 +14,5 @@ elgg_version 2010030101 - simple true diff --git a/mod/garbagecollector/manifest.xml b/mod/garbagecollector/manifest.xml index 466e49d61..0da71cd6b 100644 --- a/mod/garbagecollector/manifest.xml +++ b/mod/garbagecollector/manifest.xml @@ -14,5 +14,4 @@ 2009030702 true - advanced diff --git a/mod/groups/manifest.xml b/mod/groups/manifest.xml index 4188aa861..542e9de01 100644 --- a/mod/groups/manifest.xml +++ b/mod/groups/manifest.xml @@ -15,5 +15,4 @@ 2010030101 true - simple diff --git a/mod/htmlawed/manifest.xml b/mod/htmlawed/manifest.xml index 0c48bbd28..b176834e5 100644 --- a/mod/htmlawed/manifest.xml +++ b/mod/htmlawed/manifest.xml @@ -14,5 +14,4 @@ 2009041701 true - advanced diff --git a/mod/invitefriends/manifest.xml b/mod/invitefriends/manifest.xml index e02c19c36..75a2d17f2 100644 --- a/mod/invitefriends/manifest.xml +++ b/mod/invitefriends/manifest.xml @@ -13,6 +13,5 @@ elgg_version 2010030101 - advanced true diff --git a/mod/likes/manifest.xml b/mod/likes/manifest.xml index f63c643a6..946cfd86b 100644 --- a/mod/likes/manifest.xml +++ b/mod/likes/manifest.xml @@ -14,5 +14,4 @@ 2010030101 true - advanced - \ No newline at end of file + diff --git a/mod/logbrowser/manifest.xml b/mod/logbrowser/manifest.xml index 585288912..846ad155a 100644 --- a/mod/logbrowser/manifest.xml +++ b/mod/logbrowser/manifest.xml @@ -14,5 +14,4 @@ 2009030702 true - advanced diff --git a/mod/logrotate/manifest.xml b/mod/logrotate/manifest.xml index ab6250ac0..503bf6cd1 100644 --- a/mod/logrotate/manifest.xml +++ b/mod/logrotate/manifest.xml @@ -14,5 +14,4 @@ 2009030702 true - advanced diff --git a/mod/members/manifest.xml b/mod/members/manifest.xml index b96684198..f5e95eb41 100644 --- a/mod/members/manifest.xml +++ b/mod/members/manifest.xml @@ -13,5 +13,4 @@ 2010030101 true - advanced - \ No newline at end of file + diff --git a/mod/messageboard/manifest.xml b/mod/messageboard/manifest.xml index 25c42ee93..5881c4e46 100644 --- a/mod/messageboard/manifest.xml +++ b/mod/messageboard/manifest.xml @@ -14,5 +14,4 @@ 2010030101 true - simple diff --git a/mod/messages/manifest.xml b/mod/messages/manifest.xml index 66ca4b444..30acc240d 100644 --- a/mod/messages/manifest.xml +++ b/mod/messages/manifest.xml @@ -14,5 +14,4 @@ 2010030101 true - simple diff --git a/mod/notifications/manifest.xml b/mod/notifications/manifest.xml index 16a67cb00..97b88fb75 100644 --- a/mod/notifications/manifest.xml +++ b/mod/notifications/manifest.xml @@ -12,6 +12,5 @@ elgg_version 2010030101 - advanced true diff --git a/mod/pages/manifest.xml b/mod/pages/manifest.xml index 4b5e5c747..a91881cab 100644 --- a/mod/pages/manifest.xml +++ b/mod/pages/manifest.xml @@ -14,6 +14,5 @@ elgg_version 2010030101 - simple true diff --git a/mod/profile/manifest.xml b/mod/profile/manifest.xml index d811e373b..a1cff4dc2 100644 --- a/mod/profile/manifest.xml +++ b/mod/profile/manifest.xml @@ -10,7 +10,6 @@ See COPYRIGHT.txt GNU Public License Version 2 true - advanced elgg_version 2011010401 diff --git a/mod/reportedcontent/manifest.xml b/mod/reportedcontent/manifest.xml index c51134608..d65b55ca3 100644 --- a/mod/reportedcontent/manifest.xml +++ b/mod/reportedcontent/manifest.xml @@ -13,5 +13,4 @@ 2010030101 true - advanced diff --git a/mod/search/manifest.xml b/mod/search/manifest.xml index 053e22178..b13e127d0 100644 --- a/mod/search/manifest.xml +++ b/mod/search/manifest.xml @@ -13,5 +13,4 @@ 2009030702 true - advanced diff --git a/mod/tagcloud/manifest.xml b/mod/tagcloud/manifest.xml index 6fcad14e2..7c64829fc 100644 --- a/mod/tagcloud/manifest.xml +++ b/mod/tagcloud/manifest.xml @@ -13,5 +13,4 @@ elgg_version 2010030101 - advanced diff --git a/mod/thewire/manifest.xml b/mod/thewire/manifest.xml index 27dd5732d..74e811bed 100644 --- a/mod/thewire/manifest.xml +++ b/mod/thewire/manifest.xml @@ -13,6 +13,5 @@ elgg_version 2010030101 - simple true diff --git a/mod/tinymce/manifest.xml b/mod/tinymce/manifest.xml index 5e69055d8..2d062d399 100644 --- a/mod/tinymce/manifest.xml +++ b/mod/tinymce/manifest.xml @@ -14,5 +14,4 @@ 2010030101 true - advanced diff --git a/mod/twitter/manifest.xml b/mod/twitter/manifest.xml index bd7176620..ffb6ccc05 100644 --- a/mod/twitter/manifest.xml +++ b/mod/twitter/manifest.xml @@ -13,5 +13,4 @@ elgg_version 2010030101 - advanced diff --git a/mod/uservalidationbyemail/manifest.xml b/mod/uservalidationbyemail/manifest.xml index df0a7cb58..3358e1119 100644 --- a/mod/uservalidationbyemail/manifest.xml +++ b/mod/uservalidationbyemail/manifest.xml @@ -14,5 +14,4 @@ 2009033101 true - advanced diff --git a/mod/zaudio/manifest.xml b/mod/zaudio/manifest.xml index ecbff85fe..423a7e863 100644 --- a/mod/zaudio/manifest.xml +++ b/mod/zaudio/manifest.xml @@ -15,5 +15,4 @@ 2010111501 true - advanced -- cgit v1.2.3