Beispiel #1
0
        public virtual ActionResult ConfirmUninstall(long id)
        {
            Plugin pluginEntity = pluginService.Find(id);

            if (pluginEntity == null)
            {
                throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.CouldNotFoundEntity"));
            }
            if (!pluginEntity.Status.Equals(PluginStatus.NotInstalled))
            {
                ICorePlugin corePlugin =
                    Application.Plugins.FirstOrDefault(pl => pl.Identifier == pluginEntity.Identifier);
                if (corePlugin == null)
                {
                    throw new HttpException((int)HttpStatusCode.NotFound, Translate("Messages.CouldNotFoundPlugin"));
                }

                corePlugin.Uninstall();

                CoreMigrator.Current.MigrateDown(corePlugin);

                pluginEntity.Status = PluginStatus.NotInstalled;
                pluginService.Save(pluginEntity);
                Success(Translate("Messages.UninstallPlugin"));
                return(RedirectToAction(MVC.Admin.Module.Index()));
            }
            Error(Translate("Messages.UnknownError"));
            return(RedirectToAction(MVC.Admin.Module.Index()));
        }