예제 #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);
        }
예제 #3
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);
        }