Beispiel #1
0
        public override ProcessorArgs ToProcessorArgs()
        {
            Install9Args args = new Install9Args(this.Tasker);

            args.ScriptsOnly = this.ScriptsOnly;
            return(args);
        }
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = (Install9Args)args;

            if (!arguments.Tasker.UnInstall || arguments.ScriptsOnly)
            {
                this.Skip();
                return;
            }

            InstallParam sqlDbPrefixParam = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == "SqlDbPrefix");

            if (sqlDbPrefixParam != null && !string.IsNullOrEmpty(sqlDbPrefixParam.Value))
            {
                foreach (SitecoreEnvironment sitecoreEnvironment in SitecoreEnvironmentHelper.SitecoreEnvironments)
                {
                    if (sitecoreEnvironment.Name == sqlDbPrefixParam.Value)
                    {
                        SitecoreEnvironmentHelper.SitecoreEnvironments.Remove(sitecoreEnvironment);
                        SitecoreEnvironmentHelper.SaveSitecoreEnvironmentData(SitecoreEnvironmentHelper.SitecoreEnvironments);
                        return;
                    }
                }
            }
        }
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = args as Install9Args;

            Assert.ArgumentNotNull(arguments, nameof(arguments));
            if (arguments.ScriptsOnly)
            {
                this.Skip();
                return;
            }

            InstallParam param = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == "DeployRoot");

            if (param != null)
            {
                int retriesNumber = 3;
                for (int i = 0; i <= retriesNumber; i++)
                {
                    if (Directory.Exists(param.Value))
                    {
                        try
                        {
                            Directory.Delete(param.Value, true);
                        }
                        catch (System.IO.IOException ex)
                        {
                            Log.Warn($"Can't remove directory: {param.Value}. {ex.Message}");
                        }
                        if (Directory.Exists(param.Value))
                        {
                            if (retriesNumber == i)
                            {
                                throw new Exception($"Can't remove directory: {param.Value}");
                            }
                            Thread.Sleep(10000);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }

            Directory.Delete(arguments.Tasker.UnInstallParamsPath, true);
        }
        protected override void Process([NotNull] ProcessorArgs args)
        {
            Install9Args arguments = args as Install9Args;

            Assert.ArgumentNotNull(arguments, nameof(arguments));
            if (arguments.ScriptsOnly)
            {
                this.Skip();
                return;
            }

            Directory.Delete(arguments.Tasker.UnInstallParamsPath, true);
            InstallParam param = arguments.Tasker.GlobalParams.FirstOrDefault(p => p.Name == "DeployRoot");

            if (param != null && !Directory.GetFileSystemEntries(param.Value).Any())
            {
                Directory.Delete(param.Value, true);
            }
        }