public ModuleResults GetResults(InstanceInfo instanceInfo, DatabaseService dbService)
        {
            var results = dbService.ExecuteAndGetDataSetFromFile("Setup/LicenseSetupModule.sql");

            return new ModuleResults
            {
                Result = results
            };
        }
Exemple #2
0
        public ModuleResults GetResults(InstanceInfo instanceInfo, DatabaseService dbService)
        {
            var sitemaps = dbService.ExecuteAndGetDataSetFromFile("SiteMapModule.sql");

            // Postprocess sitemaps of all sites
            foreach (DataTable sitemap in sitemaps.Tables)
            {
                bool outputCacheEnabled = dbService.GetSetting<bool>("CMSEnableOutputCache", sitemap.TableName);

                // process every row of the sitemap
                foreach (DataRow row in sitemap.Rows)
                {
                    // Get effective value of columns that can be inherited
                    foreach (var column in ColumnsWithInheritance)
                    {
                        string origColName = column.Key + "Orig";

                        // Add new column to the table for storing original column value
                        if (!sitemap.Columns.Contains(origColName))
                        {
                            int colIndex = sitemap.Columns.IndexOf(column.Key);
                            sitemap.Columns.Add(origColName).SetOrdinal(colIndex);
                        }

                        // Copy original value to the new column
                        row[origColName] = row[column.Key];

                        if (column.Key == "OutputCache" && !outputCacheEnabled)
                        {
                            // Special case - output cache can be disabled in settings and then effective value is always 0
                            row[column.Key] = 0;
                        }
                        else
                        {
                            // Set effective value to the column
                            row[column.Key] = GetEffectiveColumnResult(sitemap, row, column.Key, column.Value);
                        }
                    }
                }

                // All post processing for the table is done - remove columns that might not be visible
                sitemap.Columns.Cast<DataColumn>()
                    .Select(x => x.ColumnName)
                    .Except(VisibleColumns)
                    .ToList()
                    .ForEach(x => sitemap.Columns.Remove(x));
            }

            return new ModuleResults
            {
                Result = sitemaps,
            };
        }