Replaces more calls to legacy UmbracoSettings with the new configuration section, fixes loads of null checks when dealing with package repository APIs
This commit is contained in:
@@ -6,5 +6,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
string Name { get; }
|
||||
Guid Id { get; }
|
||||
string RepositoryUrl { get; }
|
||||
string WebServiceUrl { get; }
|
||||
bool HasCustomWebServiceUrl { get; }
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,42 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
|
||||
{
|
||||
internal class RepositoryElement : ConfigurationElement, IRepository
|
||||
{
|
||||
[ConfigurationProperty("name")]
|
||||
[ConfigurationProperty("name", IsRequired = true)]
|
||||
public string Name
|
||||
{
|
||||
get { return (string)base["name"]; }
|
||||
set { base["name"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("guid")]
|
||||
[ConfigurationProperty("guid", IsRequired = true)]
|
||||
public Guid Id
|
||||
{
|
||||
get { return (Guid)base["guid"]; }
|
||||
set { base["guid"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("repositoryurl", DefaultValue = "http://packages.umbraco.org")]
|
||||
public string RepositoryUrl
|
||||
{
|
||||
get { return (string)base["repositoryurl"]; }
|
||||
set { base["repositoryurl"] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty("repositoryurl", DefaultValue = "/umbraco/webservices/api/repository.asmx")]
|
||||
public string WebServiceUrl
|
||||
{
|
||||
get { return (string)base["repositoryurl"]; }
|
||||
set { base["repositoryurl"] = value; }
|
||||
}
|
||||
|
||||
public bool HasCustomWebServiceUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
var prop = Properties["repositoryurl"];
|
||||
var repoUrl = this[prop] as ConfigurationElement;
|
||||
return (repoUrl != null && repoUrl.ElementInformation.IsPresent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user