예제 #1
0
        public static void DeletePackage(PackageInfo package)
        {
            switch (package.PackageType)
            {
            case "Auth_System":
                Authentication.AuthenticationInfo authSystem = Authentication.AuthenticationController.GetAuthenticationServiceByPackageID(package.PackageID);
                if (authSystem != null)
                {
                    Authentication.AuthenticationController.DeleteAuthentication(authSystem);
                }
                break;

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

            case "Module":
                DesktopModuleController 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;
            }
            DeletePackage(package.PackageID);
        }
예제 #2
0
        private static void UpgradeToVersion_513()
        {
            //Ensure that default language is present (not neccessarily enabled)
            Locale defaultLanguage = Localization.Localization.GetLocale("en-US");
            if (defaultLanguage == null)
            {
                defaultLanguage = new Locale();
            }
            defaultLanguage.Code = "en-US";
            defaultLanguage.Text = "English (United States)";
            Localization.Localization.SaveLanguage(defaultLanguage);

            //Ensure that there is a Default Authorization System
            PackageInfo package = PackageController.GetPackageByName("DefaultAuthentication");
            if (package == null)
            {
                package = new PackageInfo();
                package.Name = "DefaultAuthentication";
                package.FriendlyName = "Default Authentication";
                package.Description = "The Default UserName/Password Authentication System for DotNetNuke.";
                package.PackageType = "Auth_System";
                package.Version = new Version(1, 0, 0);
                package.Owner = "DotNetNuke";
                package.License = Localization.Localization.GetString("License", Localization.Localization.GlobalResourceFile);
                package.Organization = "DotNetNuke Corporation";
                package.Url = "www.dotnetnuke.com";
                package.Email = "*****@*****.**";
                package.ReleaseNotes = "There are no release notes for this version.";
                package.IsSystemPackage = true;
                PackageController.SavePackage(package);

                //Add Authentication System
                Authentication.AuthenticationInfo authSystem = Authentication.AuthenticationController.GetAuthenticationServiceByType("DNN");
                if (authSystem == null)
                {
                    authSystem = new Authentication.AuthenticationInfo();
                }
                authSystem.PackageID = package.PackageID;
                authSystem.AuthenticationType = "DNN";
                authSystem.SettingsControlSrc = "DesktopModules/AuthenticationServices/DNN/Settings.ascx";
                authSystem.LoginControlSrc = "DesktopModules/AuthenticationServices/DNN/Login.ascx";
                authSystem.IsEnabled = true;

                if (authSystem.AuthenticationID == Null.NullInteger)
                {
                    Authentication.AuthenticationController.AddAuthentication(authSystem);
                }
                else
                {
                    Authentication.AuthenticationController.UpdateAuthentication(authSystem);
                }
            }
        }