diff --git a/core/PluginsManager.php b/core/PluginsManager.php index 2f8caad8876..7f1772235c0 100644 --- a/core/PluginsManager.php +++ b/core/PluginsManager.php @@ -201,6 +201,11 @@ public function uninstallPlugin($pluginName) if(!$this->isPluginInFilesystem($pluginName)) { throw new \Exception("You are trying to uninstall the plugin $pluginName but it was not found in the directory piwik/plugins/"); } + + $this->returnLoadedPluginsInfo(); + $plugin = $this->getLoadedPlugin($pluginName); + $plugin->uninstall(); + self::deletePluginFromFilesystem($pluginName); $this->removePluginFromPluginsConfig($pluginName); diff --git a/lang/en.json b/lang/en.json index e38b5048e2a..e0bdeed492d 100644 --- a/lang/en.json +++ b/lang/en.json @@ -717,7 +717,8 @@ "MenuPlatform": "Platform", "MenuExtend": "Extend", "PluginNotCompatibleWith": "%1$s plugin is not compatible with %2$s.", - "PluginAskDevToUpdate": "If you enjoyed this plugin, maybe you can ask the developers to update it to work on the latest Piwik. " + "PluginAskDevToUpdate": "If you enjoyed this plugin, maybe you can ask the developers to update it to work on the latest Piwik. ", + "UninstallConfirm": "You are about to uninstall a plugin. The plugin will be completely removed from your platform and it won't be recoverable. Are you sure you want to do this?" }, "CoreUpdater": { "PluginDescription": "Piwik updating mechanism", diff --git a/plugins/CorePluginsAdmin/CorePluginsAdmin.php b/plugins/CorePluginsAdmin/CorePluginsAdmin.php index 4b3e012400e..53bbdf0a76d 100644 --- a/plugins/CorePluginsAdmin/CorePluginsAdmin.php +++ b/plugins/CorePluginsAdmin/CorePluginsAdmin.php @@ -89,6 +89,7 @@ public function getJsFiles(&$jsFiles) { $jsFiles[] = "plugins/CoreHome/javascripts/popover.js"; $jsFiles[] = "plugins/CorePluginsAdmin/javascripts/pluginDetail.js"; + $jsFiles[] = "plugins/CorePluginsAdmin/javascripts/pluginOverview.js"; } } diff --git a/plugins/CorePluginsAdmin/javascripts/pluginOverview.js b/plugins/CorePluginsAdmin/javascripts/pluginOverview.js new file mode 100644 index 00000000000..28b4915dd73 --- /dev/null +++ b/plugins/CorePluginsAdmin/javascripts/pluginOverview.js @@ -0,0 +1,26 @@ +/*! + * Piwik - Web Analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +$(document).ready(function () { + + $('#plugins .uninstall').click(function (event) { + event.preventDefault(); + + var link = $(this).attr('href'); + + if (!link) { + return; + } + + piwikHelper.modalConfirm('#confirmUninstallPlugin', { + yes: function () { + window.location = link; + } + }); + }); + +}); \ No newline at end of file diff --git a/plugins/CorePluginsAdmin/templates/macros.twig b/plugins/CorePluginsAdmin/templates/macros.twig index b8f27113090..be90e4e20ce 100644 --- a/plugins/CorePluginsAdmin/templates/macros.twig +++ b/plugins/CorePluginsAdmin/templates/macros.twig @@ -43,6 +43,14 @@ {% macro tablePlugins(pluginsInfo, activateNonce, deactivateNonce, uninstallNonce, isTheme) %} +
+ +

{{ 'CorePluginsAdmin_UninstallConfirm'|translate }}

+ + + +
+
@@ -84,7 +92,7 @@ {{ 'CorePluginsAdmin_Active'|translate }} {% else %} {{ 'CorePluginsAdmin_Inactive'|translate }}
- - {% if plugin.uninstallable %}uninstall{% endif %} {% endif %} diff --git a/plugins/SecurityInfo b/plugins/SecurityInfo index 7d4f2ea0d63..22333f8dbc9 160000 --- a/plugins/SecurityInfo +++ b/plugins/SecurityInfo @@ -1 +1 @@ -Subproject commit 7d4f2ea0d63886eda79087ef5884be12bf63b318 +Subproject commit 22333f8dbc9b7ce3a3f003e8d0b657705d188cca