Ejemplo n.º 1
0
        public bool Execute(string packageName, XmlNode xmlData)
        {
            try
            {
                Initialize(xmlData);

                PackageActionsHelpers.BackupExistingXmlConfig(_targetConfigFullPath);

                if (!_inTestMode)
                {
                    Log.Add(LogTypes.Debug, -1, string.Format("MergeConfigFiles: {0} into: {1}", _sourceConfigFullPath, _targetConfigFullPath));
                }
                var config = new ConfigFileManager(_targetConfigFullPath, _sourceConfigFullPath);
                config.Save();

                if (!String.IsNullOrWhiteSpace(SourceConfigIntegratedModePath))
                {
                    if (!_inTestMode)
                    {
                        Log.Add(LogTypes.Debug, -1, string.Format("MergeConfigFiles (IIS7): {0} into: {1}", _sourceConfigIntegratedModeFullPath, _targetConfigFullPath));
                    }
                    config = new ConfigFileManager(_targetConfigFullPath, _sourceConfigIntegratedModeFullPath);
                    config.Save();
                }
            }
            catch (Exception ex)
            {
                if (!_inTestMode)
                {
                    Log.Add(LogTypes.Error, -1, string.Concat(new object[] { ex.Message, "\n", ex.TargetSite, "\n", ex.StackTrace }));
                }
                return(false);
            }
            return(true);
        }
        public bool Execute(string packageName, XmlNode xmlData)
        {
            Initialize(xmlData);

            PackageActionsHelpers.BackupExistingXmlConfig(_targetConfigFullPath);

            var config = new ConfigFileManager(_targetConfigFullPath);

            var current = GetRewritingNode(config, "umbracoReservedPaths");

            if (!String.IsNullOrEmpty(current))
            {
                if (!current.Contains(",~/ucommerceapi/"))
                {
                    AddValue(config, "umbracoReservedPaths", string.Concat(current, ",~/ucommerceapi/"));
                }
            }
            else
            {
                throw new ArgumentOutOfRangeException("umbracoReservedPaths", "No setting for umbracoReservedPaths could be found in your web.config -are you sure this is an Umbraco install?");
            }

            config.Save();

            return(true);
        }
Ejemplo n.º 3
0
        private void Initialize(XmlNode xmlData)
        {
            TargetConfigPath = PackageActionsHelpers.GetAttributeValueFromNode(xmlData, "targetConfig");
            SourceConfigPath = PackageActionsHelpers.GetAttributeValueFromNode(xmlData, "sourceConfig");

            _targetConfigFullPath = PackageActionsHelpers.GetLocalPath(TargetConfigPath);
            _sourceConfigFullPath = PackageActionsHelpers.GetLocalPath(SourceConfigPath);
        }
Ejemplo n.º 4
0
        public bool Execute(string packageName, XmlNode xmlData)
        {
            Initialize(xmlData);

            PackageActionsHelpers.BackupExistingXmlConfig(_targetConfigFullPath);

            var existingRewrites = XElement.Load(_targetConfigFullPath);
            var newRewrites      = XElement.Load(_sourceConfigFullPath);

            var mergedRewrites = new UrlRewriteRulesInstaller().Merge(existingRewrites, newRewrites);

            mergedRewrites.Save(_targetConfigFullPath);

            return(true);
        }
Ejemplo n.º 5
0
        public XmlNode SampleXml()
        {
            string value = string.Format("<Action runat=\"install\" undo=\"true\" alias=\"{0}\" targetConfig=\"~/web.config\" sourceConfig=\"~/umbraco/ucommerce/install/uCommerce.config\" sourceConfigIntegratedMode=\"~/umbraco/ucommerce/install/uCommerce.IIS7.config\"/>", Alias());

            return(PackageActionsHelpers.ParseStringToXmlNode(value));
        }
Ejemplo n.º 6
0
        public XmlNode SampleXml()
        {
            string value = string.Format("<Action runat=\"install\" undo=\"true\" alias=\"{0}\" targetConfig=\"~/config/UrlRewriting.config\" sourceConfig=\"~/umbraco/ucommerce/install/uCommerce.DemoStore.UrlRewriting.config\" />", Alias());

            return(PackageActionsHelpers.ParseStringToXmlNode(value));
        }