コード例 #1
0
        protected virtual string GetLogsFolderPath()
        {
            using (new ProfileSection("Get log folder path", this))
            {
                try
                {
                    var dataFolder = RuntimeSettingsAccessor.GetSitecoreSettingValue("LogFolder");
                    var result     = MapPath(dataFolder);

                    return(ProfileSection.Result(result));
                }
                catch (Exception ex)
                {
                    var dataLogs = Path.Combine(DataFolderPath, "logs");
                    if (FileSystem.FileSystem.Local.Directory.Exists(dataLogs))
                    {
                        Log.Error(ex, $"Cannot get logs folder of {WebRootPath}");

                        return(dataLogs);
                    }

                    throw new InvalidOperationException($"Cannot get logs folder of {WebRootPath}");
                }
            }
        }
コード例 #2
0
        protected virtual string GetTempFolderPath()
        {
            using (new ProfileSection("Get temp folder path", this))
            {
                try
                {
                    var tempFolder = RuntimeSettingsAccessor.GetScVariableValue("tempFolder");
                    Assert.IsNotNull(tempFolder, "The <sc.variable name=\"tempFolder\" value=\"...\" /> element is not presented in the web.config file");
                    Assert.IsNotNullOrEmpty(tempFolder, "The <sc.variable name=\"tempFolder\" value=\"...\" /> element value is empty string");

                    var result = MapPath(tempFolder);

                    return(ProfileSection.Result(result));
                }
                catch (Exception ex)
                {
                    var websiteTemp = Path.Combine(WebRootPath, "temp");
                    if (FileSystem.FileSystem.Local.Directory.Exists(websiteTemp))
                    {
                        Log.Error(ex, $"Cannot get temp folder of {WebRootPath}");

                        return(websiteTemp);
                    }

                    throw new InvalidOperationException($"Cannot get temp folder of {WebRootPath}");
                }
            }
        }
コード例 #3
0
        protected virtual string GetDataFolderPath()
        {
            using (new ProfileSection("Get data folder path", this))
            {
                try
                {
                    var dataFolder = RuntimeSettingsAccessor.GetScVariableValue("dataFolder");
                    Assert.IsNotNull(dataFolder, "The <sc.variable name=\"dataFolder\" value=\"...\" /> element is not presented in the web.config file");
                    Assert.IsNotNullOrEmpty(dataFolder, "The <sc.variable name=\"dataFolder\" value=\"...\" /> element value is empty string");

                    return(MapPath(dataFolder));
                }
                catch (Exception ex)
                {
                    var rootData = Path.Combine(Path.GetDirectoryName(WebRootPath), "Data");
                    if (FileSystem.FileSystem.Local.Directory.Exists(rootData))
                    {
                        Log.Error(ex, $"Cannot get data folder of {WebRootPath}");

                        return(rootData);
                    }

                    throw new InvalidOperationException($"Cannot get data folder of {WebRootPath}");
                }
            }
        }
コード例 #4
0
 protected virtual ICollection <Database> GetAttachedDatabases()
 {
     using (new ProfileSection("Get attached databases", this))
     {
         return(RuntimeSettingsAccessor.GetDatabases());
     }
 }
コード例 #5
0
 private ICollection <MongoDbDatabase> GetMongoDatabases()
 {
     using (new ProfileSection("Get mongo databases", this))
     {
         return(RuntimeSettingsAccessor.GetMongoDatabases());
     }
 }
コード例 #6
0
        public virtual XmlDocument GetWebResultConfig(bool normalize = false)
        {
            using (new ProfileSection("Get web.config.result.xml config", this))
            {
                ProfileSection.Argument("normalize", normalize);

                return(RuntimeSettingsAccessor.GetWebConfigResult(normalize));
            }
        }
コード例 #7
0
        public virtual XmlDocument GetShowconfig(bool normalize = false)
        {
            using (new ProfileSection("Get showconfig.xml config", this))
            {
                ProfileSection.Argument("normalize", normalize);

                return(RuntimeSettingsAccessor.GetShowconfig(normalize));
            }
        }