예제 #1
0
        public override ReportResults GetResults()
        {
            var cmsSettingsKeysNames = new SettingsKeyAnalyzers(null)
                                       .Analyzers
                                       .Select(analyzer => analyzer.Parameters[0].Name);

            var cmsSettingsKeys = databaseService.ExecuteSqlFromFile <CmsSettingsKey>(
                Scripts.GetSecurityCmsSettings,
                new { cmsSettingsKeysNames }
                );

            var cmsSettingsKeyResults = GetCmsSettingsKeyResults(cmsSettingsKeys);

            var cmsSettingsCategoryIdsOnPaths = cmsSettingsKeyResults
                                                .SelectMany(cmsSettingsKeyResult => cmsSettingsKeyResult.GetCategoryIdsOnPath())
                                                .Distinct();

            var cmsSettingsCategories = databaseService.ExecuteSqlFromFile <CmsSettingsCategory>(
                Scripts.GetCmsSettingsCategories,
                new { cmsSettingsCategoryIdsOnPaths }
                );

            var sites = instanceService
                        .GetInstanceDetails(instanceService.CurrentInstance)
                        .Sites
                        .Append(new Site()
            {
                Id   = 0,
                Name = Metadata.Terms.GlobalSiteName
            });

            var instancePath = instanceService.CurrentInstance.Path;

            var resxValues = cmsFileService.GetResourceStringsFromResx(instancePath);

            var localizedCmsSettingsKeyResults = cmsSettingsKeyResults
                                                 .Select(cmsSettingsKeyResult => new CmsSettingsKeyResult(
                                                             cmsSettingsKeyResult,
                                                             cmsSettingsCategories,
                                                             sites,
                                                             resxValues
                                                             ));

            var webConfigXml = cmsFileService.GetXmlDocument(instancePath, DefaultKenticoPaths.WebConfigFile);

            var webConfigSettingsResults = GetWebConfigSettingsResults(webConfigXml);

            return(CompileResults(localizedCmsSettingsKeyResults, webConfigSettingsResults));
        }
예제 #2
0
        private void ResolveSettingsDisplayNames(Instance instance, IEnumerable <SettingsKey> databaseSettingsValues)
        {
            var resxValues = _cmsFileService.GetResourceStringsFromResx(instance.Path);

            foreach (var databaseSettingsValue in databaseSettingsValues)
            {
                var key = databaseSettingsValue.KeyDisplayName
                          .Replace("{$", string.Empty)
                          .Replace("$}", string.Empty)
                          .ToLowerInvariant();

                if (resxValues.ContainsKey(key))
                {
                    databaseSettingsValue.KeyDisplayName = resxValues[key];
                }
            }
        }
예제 #3
0
        public override ReportResults GetResults()
        {
            var instance = _instanceService.CurrentInstance;

            var databaseSettingsValues =
                _databaseService.ExecuteSqlFromFile <CmsSettingsKey>(Scripts.GetCMSSettingsKeysForDebug);

            var resxValues =
                _cmsFileService.GetResourceStringsFromResx(
                    instance.Path,
                    DefaultKenticoPaths.PrimaryResxFile
                    );

            ResolveSettingsDisplayNames(
                databaseSettingsValues,
                resxValues
                );

            var webConfig = _cmsFileService.GetXDocument(
                instance.Path,
                DefaultKenticoPaths.WebConfigFile
                );

            var compilationDebugIsEnabled =
                GetBooleanValueofSectionAttribute(
                    webConfig,
                    "system.web",
                    "compilation",
                    "debug"
                    );

            var traceIsEnabled = GetBooleanValueofSectionAttribute(
                webConfig,
                "system.web",
                "trace",
                "enabled"
                );

            return(CompileResults(
                       databaseSettingsValues,
                       compilationDebugIsEnabled,
                       traceIsEnabled
                       ));
        }