Пример #1
0
        public static void Main()
        {
            try {
                XmlConfigurator.Configure();
#if !DEBUG
                var installer = new Installer.Installer();
                if (installer.Update())
                {
                    return;
                }
#endif

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Initializer.Initialize();
#if !DEBUG
                Application.ThreadException += (sender, e) => HandleException(e.Exception);
#endif

                Application.Run(new Shell());
#if !DEBUG
            }
            catch (Exception e) {
                HandleException(e);
            }
#else
            }
Пример #2
0
        private static void Install(InstallerOptions opts)
        {
            var env = EnvironmentManager.Get(opts.Environment);

            if (env == null)
            {
                Console.WriteLine(
                    "you must create an environment first - try dyndle help add-environment");
                return;
            }
            CoreserviceClientFactory.SetEnvironment(env);

            var module = new Installer.Installer(opts);

            var output = module.Run();

            Console.WriteLine(output);
        }
Пример #3
0
        public static bool InstallPackage(string file, string packageType, bool writeFeedback)
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "InstallPackage:" + file);
            bool success = Null.NullBoolean;
            if (writeFeedback)
            {
                HtmlUtils.WriteFeedback(HttpContext.Current.Response, 2, "Installing Package File " + Path.GetFileNameWithoutExtension(file) + ": ");
            }

            bool deleteTempFolder = true;
            if (packageType == "Skin" || packageType == "Container")
            {
                deleteTempFolder = Null.NullBoolean;
            }

            var installer = new Installer.Installer(new FileStream(file, FileMode.Open, FileAccess.Read), Globals.ApplicationMapPath, true, deleteTempFolder);

            //Check if manifest is valid
            if (installer.IsValid)
            {
                installer.InstallerInfo.RepairInstall = true;
                success = installer.Install();
            }
            else
            {
                if (installer.InstallerInfo.ManifestFile == null)
                {
                    //Missing manifest
                    if (packageType == "Skin" || packageType == "Container")
                    {
                        //Legacy Skin/Container
                        string tempInstallFolder = installer.TempInstallFolder;
                        string manifestFile = Path.Combine(tempInstallFolder, Path.GetFileNameWithoutExtension(file) + ".dnn");
                        var manifestWriter = new StreamWriter(manifestFile);
                        manifestWriter.Write(LegacyUtil.CreateSkinManifest(file, packageType, tempInstallFolder));
                        manifestWriter.Close();

                        installer = new Installer.Installer(tempInstallFolder, manifestFile, HttpContext.Current.Request.MapPath("."), true);

                        //Set the Repair flag to true for Batch Install
                        installer.InstallerInfo.RepairInstall = true;

                        success = installer.Install();
                    }
                    else if (Globals.Status != Globals.UpgradeStatus.None)
                    {
                        var message = string.Format(Localization.Localization.GetString("InstallPackageError", Localization.Localization.ExceptionsResourceFile), file, "Manifest file missing");
                        DnnInstallLogger.InstallLogError(message);
                    }
                }
                else
                {
                    //log the failure log when installer is invalid and not caught by mainfest file missing.
                    foreach (var log in installer.InstallerInfo.Log.Logs
                                                .Where(l => l.Type == LogType.Failure))
                    {
                        Logger.Error(log.Description);
                        DnnInstallLogger.InstallLogError(log.Description);
                    }

                    success = false;
                }
            }

            if (writeFeedback)
            {
                HtmlUtils.WriteSuccessError(HttpContext.Current.Response, success);
            }
            if (success)
            {
                // delete file
                try
                {
                    File.SetAttributes(file, FileAttributes.Normal);
                    File.Delete(file);
                }
                catch (Exception exc)
                {
                    Logger.Error(exc);
                }
            }
            return success;
        }
Пример #4
0
 private static void UninstallPackage(string packageName)
 {
     var searchInput = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == packageName);
     if (searchInput != null)
     {
         var searchInputInstaller = new Installer.Installer(searchInput, Globals.ApplicationMapPath);
         searchInputInstaller.UnInstall(true);
     }
 }
Пример #5
0
 private static void UninstallPackage(string packageName)
 {
     var searchInput = PackageController.GetPackageByName(packageName);
     if (searchInput != null)
     {
         var searchInputInstaller = new Installer.Installer(searchInput, Globals.ApplicationMapPath);
         searchInputInstaller.UnInstall(true);
     }
 }
Пример #6
0
        public static bool InstallPackage(string strFile, string packageType, bool writeFeedback)
        {
            bool blnSuccess = Null.NullBoolean;
            if (writeFeedback)
            {
                HtmlUtils.WriteFeedback(HttpContext.Current.Response, 2, "Installing Package File " + Path.GetFileNameWithoutExtension(strFile) + ": ");
            }

            bool deleteTempFolder = true;
            if (packageType == "Skin" || packageType == "Container")
            {
                deleteTempFolder = Null.NullBoolean;
            }

            Installer.Installer objInstaller = new Installer.Installer(new FileStream(strFile, FileMode.Open, FileAccess.Read), Common.Globals.ApplicationMapPath, true, deleteTempFolder);

            //Check if manifest is valid
            if (objInstaller.IsValid)
            {
                objInstaller.InstallerInfo.RepairInstall = true;
                blnSuccess = objInstaller.Install();
            }
            else
            {
                if (objInstaller.InstallerInfo.ManifestFile == null)
                {
                    //Missing manifest
                    if (packageType == "Skin" || packageType == "Container")
                    {
                        //Legacy Skin/Container
                        string TempInstallFolder = objInstaller.TempInstallFolder;
                        string ManifestFile = Path.Combine(TempInstallFolder, Path.GetFileNameWithoutExtension(strFile) + ".dnn");
                        StreamWriter manifestWriter = new StreamWriter(ManifestFile);
                        manifestWriter.Write(LegacyUtil.CreateSkinManifest(strFile, packageType, TempInstallFolder));
                        manifestWriter.Close();

                        objInstaller = new Installer.Installer(TempInstallFolder, ManifestFile, HttpContext.Current.Request.MapPath("."), true);

                        //Set the Repair flag to true for Batch Install
                        objInstaller.InstallerInfo.RepairInstall = true;

                        blnSuccess = objInstaller.Install();
                    }
                }
                else
                {
                    blnSuccess = false;
                }
            }

            if (writeFeedback)
            {
                HtmlUtils.WriteSuccessError(HttpContext.Current.Response, blnSuccess);
            }
            if (blnSuccess)
            {
                // delete file
                try
                {
                    File.SetAttributes(strFile, FileAttributes.Normal);
                    File.Delete(strFile);
                }
                catch
                {
                }
                // error removing the file
            }
            return blnSuccess;
        }
Пример #7
0
 private static void UpgradeToVersion624()
 {
     var package = PackageController.GetPackageByName("DotNetNuke.MarketPlace");
     if (package != null)
     {
         var installer = new Installer.Installer(package, Globals.ApplicationMapPath);
         installer.UnInstall(true);
     }
 }