コード例 #1
0
        public void DeleteExtensionPackage(PackageInfo package)
        {
            switch (package.PackageType)
            {
            case "Auth_System":
                AuthenticationInfo authSystem = AuthenticationController.GetAuthenticationServiceByPackageID(package.PackageID);
                if (authSystem != null)
                {
                    AuthenticationController.DeleteAuthentication(authSystem);
                }

                break;

            case "CoreLanguagePack":
                LanguagePackInfo languagePack = LanguagePackController.GetLanguagePackByPackage(package.PackageID);
                if (languagePack != null)
                {
                    LanguagePackController.DeleteLanguagePack(languagePack);
                }

                break;

            case "Module":
                var controller = new DesktopModuleController();
                DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByPackageID(package.PackageID);
                if (desktopModule != null)
                {
                    controller.DeleteDesktopModule(desktopModule);
                }

                break;

            case "SkinObject":
                SkinControlInfo skinControl = SkinControlController.GetSkinControlByPackageID(package.PackageID);
                if (skinControl != null)
                {
                    SkinControlController.DeleteSkinControl(skinControl);
                }

                break;
            }

            DeletePackageInternal(package);
        }
コード例 #2
0
 private void DeleteModule()
 {
     try
     {
         DesktopModuleInfo tempDesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID);
         if (tempDesktopModule != null)
         {
             if ((DesktopModule != null) && (!string.IsNullOrEmpty(DesktopModule.CodeSubDirectory)))
             {
                 Config.RemoveCodeSubDirectory(DesktopModule.CodeSubDirectory);
             }
             DesktopModuleController controller = new DesktopModuleController();
             controller.DeleteDesktopModule(tempDesktopModule);
         }
         Log.AddInfo(string.Format(Util.MODULE_UnRegistered, tempDesktopModule.ModuleName));
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
コード例 #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// The DeleteModule method deletes the Module from the data Store.
        /// </summary>
        /// -----------------------------------------------------------------------------
        private void DeleteModule()
        {
            try
            {
                //Attempt to get the Desktop Module
                DesktopModuleInfo tempDesktopModule = DesktopModuleController.GetDesktopModuleByPackageID(Package.PackageID);
                if (tempDesktopModule != null)
                {
                    var modules = ModuleController.Instance.GetModulesByDesktopModuleId(tempDesktopModule.DesktopModuleID);
                    //Remove CodeSubDirectory
                    if ((_desktopModule != null) && (!string.IsNullOrEmpty(_desktopModule.CodeSubDirectory)))
                    {
                        Config.RemoveCodeSubDirectory(_desktopModule.CodeSubDirectory);
                    }
                    var controller = new DesktopModuleController();


                    Log.AddInfo(string.Format(Util.MODULE_UnRegistered, tempDesktopModule.ModuleName));
                    //remove admin/host pages
                    if (!String.IsNullOrEmpty(tempDesktopModule.AdminPage))
                    {
                        string tabPath = "//Admin//" + tempDesktopModule.AdminPage;

                        var portals = PortalController.Instance.GetPortals();
                        foreach (PortalInfo portal in portals)
                        {
                            var tabID = TabController.GetTabByTabPath(portal.PortalID, tabPath, Null.NullString);

                            TabInfo temp = TabController.Instance.GetTab(tabID, portal.PortalID);
                            if ((temp != null))
                            {
                                var  mods             = TabModulesController.Instance.GetTabModules((temp));
                                bool noOtherTabModule = true;
                                foreach (ModuleInfo mod in mods)
                                {
                                    if (mod.DesktopModuleID != tempDesktopModule.DesktopModuleID)
                                    {
                                        noOtherTabModule = false;
                                    }
                                }
                                if (noOtherTabModule)
                                {
                                    Log.AddInfo(string.Format(Util.MODULE_AdminPageRemoved, tempDesktopModule.AdminPage, portal.PortalID));
                                    TabController.Instance.DeleteTab(tabID, portal.PortalID);
                                }
                                Log.AddInfo(string.Format(Util.MODULE_AdminPagemoduleRemoved, tempDesktopModule.AdminPage, portal.PortalID));
                            }
                        }
                    }
                    if (!String.IsNullOrEmpty(tempDesktopModule.HostPage))
                    {
                        Upgrade.Upgrade.RemoveHostPage(tempDesktopModule.HostPage);
                        Log.AddInfo(string.Format(Util.MODULE_HostPageRemoved, tempDesktopModule.HostPage));
                        Log.AddInfo(string.Format(Util.MODULE_HostPagemoduleRemoved, tempDesktopModule.HostPage));
                    }

                    controller.DeleteDesktopModule(tempDesktopModule);
                    //Remove all the tab versions related with the module.
                    foreach (var module in modules)
                    {
                        var moduleInfo = module as ModuleInfo;
                        if (moduleInfo != null)
                        {
                            TabVersionController.Instance.DeleteTabVersionDetailByModule(moduleInfo.ModuleID);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// cmdDelete_Click runs when the Delete Button is clicked
        /// </summary>
        /// <history>
        ///     [cnurse]	9/28/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        protected void cmdDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Null.IsNull(DesktopModuleId))
                {
                    string strRoot = Request.MapPath("~/DesktopModules/" + txtFolderName.Text) + "\\";

                    // process uninstall script
                    string strProviderType = "data";
                    ProviderConfiguration objProviderConfiguration = ProviderConfiguration.GetProviderConfiguration(strProviderType);
                    string strUninstallScript = "Uninstall." + objProviderConfiguration.DefaultProvider;
                    if (File.Exists(strRoot + strUninstallScript))
                    {
                        // read uninstall script
                        StreamReader objStreamReader;
                        objStreamReader = File.OpenText(strRoot + strUninstallScript);
                        string strScript = objStreamReader.ReadToEnd();
                        objStreamReader.Close();

                        // execute uninstall script
                        PortalSettings.ExecuteScript(strScript);
                    }

                    if (Directory.Exists(strRoot))
                    {
                        if (chkDelete.Checked)
                        {
                            //runtime so remove files/folders
                            // find dnn manifest file
                            string[] arrFiles = Directory.GetFiles(strRoot, "*.dnn.config");
                            if (arrFiles.Length == 0)
                            {
                                arrFiles = Directory.GetFiles(strRoot, "*.dnn");   // legacy versions stored the *.dnn files unprotected
                            }
                            if (arrFiles.Length != 0)
                            {
                                if (File.Exists(strRoot + Path.GetFileName(arrFiles[0])))
                                {
                                    XmlDocument xmlDoc = new XmlDocument();

                                    // load the manifest file
                                    xmlDoc.Load(strRoot + Path.GetFileName(arrFiles[0]));

                                    // check version
                                    XmlNode myNodeModule = null;
                                    switch (xmlDoc.DocumentElement.LocalName.ToLower())
                                    {
                                    case "module":

                                        myNodeModule = xmlDoc.SelectSingleNode("//module");
                                        break;

                                    case "dotnetnuke":

                                        string version = xmlDoc.DocumentElement.Attributes["version"].InnerText;
                                        switch (version)
                                        {
                                        case "2.0":

                                            // V2 allows for multiple folders in a single DNN definition - we need to identify the correct node
                                            foreach (XmlNode nodeModule in xmlDoc.SelectNodes("//dotnetnuke/folders/folder"))
                                            {
                                                if (nodeModule.SelectSingleNode("name").InnerText.Trim() == txtFriendlyName.Text)
                                                {
                                                    myNodeModule = nodeModule;
                                                    break;
                                                }
                                            }
                                            break;

                                        case "3.0":

                                            // V3 also allows for multiple folders in a single DNN definition - but uses module name
                                            foreach (XmlNode nodeModule in xmlDoc.SelectNodes("//dotnetnuke/folders/folder"))
                                            {
                                                if (nodeModule.SelectSingleNode("name").InnerText.Trim() == txtModuleName.Text)
                                                {
                                                    myNodeModule = nodeModule;
                                                    break;
                                                }
                                            }
                                            break;
                                        }
                                        break;
                                    }

                                    // loop through file nodes
                                    foreach (XmlNode nodeFile in myNodeModule.SelectNodes("files/file"))
                                    {
                                        string strFileName      = nodeFile.SelectSingleNode("name").InnerText.Trim();
                                        string strFileExtension = Path.GetExtension(strFileName).Replace(".", "");
                                        if (strFileExtension == "dll")
                                        {
                                            // remove DLL from /bin
                                            strFileName = Request.MapPath("~/bin/") + strFileName;
                                        }
                                        if (File.Exists(strFileName))
                                        {
                                            File.SetAttributes(strFileName, FileAttributes.Normal);
                                            File.Delete(strFileName);
                                        }
                                    }

                                    //Recursively Delete any sub Folders
                                    DeleteSubFolders(strRoot, true);

                                    //Recursively delete AppCode folders
                                    string appCode = strRoot.Replace("DesktopModules", "App_Code");
                                    DeleteSubFolders(appCode, true);

                                    //Delete the <codeSubDirectory> node in web.config
                                    Config.RemoveCodeSubDirectory(txtFolderName.Text);
                                }
                            }
                        }
                    }

                    // delete the desktopmodule database record
                    DesktopModuleController objDesktopModules = new DesktopModuleController();
                    objDesktopModules.DeleteDesktopModule(DesktopModuleId);
                }

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception exc)  //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }