diff --git a/src/umbraco.businesslogic/Application.cs b/src/umbraco.businesslogic/Application.cs
index 6d654e4703..8603714628 100644
--- a/src/umbraco.businesslogic/Application.cs
+++ b/src/umbraco.businesslogic/Application.cs
@@ -9,8 +9,6 @@ using System.Web;
using System.Xml.Linq;
using umbraco.DataLayer;
using umbraco.IO;
-using umbraco.interfaces;
-using umbraco.BusinessLogic.Utils;
using System.Runtime.CompilerServices;
using umbraco.businesslogic;
@@ -21,30 +19,47 @@ namespace umbraco.BusinessLogic
///
public class Application
{
- private static ISqlHelper _sqlHelper;
+ private static ISqlHelper _sqlHelper;
- private const string CACHE_KEY = "ApplicationCache";
+ private const string CacheKey = "ApplicationCache";
+ internal const string AppConfigFileName = "applications.config";
+ private static string _appConfig;
+ private static readonly object Locker = new object();
- private static readonly string _appConfig =
- IOHelper.MapPath(SystemDirectories.Config + "/applications.config");
-
- private static readonly object m_Locker = new object();
+ ///
+ /// gets/sets the application.config file path
+ ///
+ ///
+ /// The setter is generally only going to be used in unit tests, otherwise it will attempt to resolve it using the IOHelper.MapPath
+ ///
+ internal static string AppConfigFilePath
+ {
+ get
+ {
+ if (string.IsNullOrWhiteSpace(_appConfig))
+ {
+ _appConfig = IOHelper.MapPath(SystemDirectories.Config + "/" + AppConfigFileName);
+ }
+ return _appConfig;
+ }
+ set { _appConfig = value; }
+ }
///
/// The cache storage for all applications
///
- private static List Apps
+ internal static List Apps
{
get
- {
- //ensure cache exists
- if (HttpRuntime.Cache[CACHE_KEY] == null)
- ReCache();
- return HttpRuntime.Cache[CACHE_KEY] as List;
+ {
+ //Whenever this is accessed, we need to ensure the cache exists!
+ EnsureCache();
+
+ return HttpRuntime.Cache[CacheKey] as List;
}
set
{
- HttpRuntime.Cache.Insert(CACHE_KEY, value);
+ HttpRuntime.Cache.Insert(CacheKey, value);
}
}
@@ -74,14 +89,7 @@ namespace umbraco.BusinessLogic
}
}
- ///
- /// A static constructor that will cache all application trees
- ///
- static Application()
- {
- //RegisterIApplications();
- Cache();
- }
+
///
/// Initializes a new instance of the class.
@@ -154,7 +162,7 @@ namespace umbraco.BusinessLogic
{
get { return _sortOrder; }
set { _sortOrder = value; }
- }
+ }
///
/// Creates a new applcation if no application with the specified alias is found.
@@ -187,14 +195,14 @@ namespace umbraco.BusinessLogic
if (!exist)
{
-// SqlHelper.ExecuteNonQuery(@"
-// insert into umbracoApp
-// (appAlias,appIcon,appName, sortOrder)
-// values (@alias,@icon,@name,@sortOrder)",
-// SqlHelper.CreateParameter("@alias", alias),
-// SqlHelper.CreateParameter("@icon", icon),
-// SqlHelper.CreateParameter("@name", name),
-// SqlHelper.CreateParameter("@sortOrder", sortOrder));
+ // SqlHelper.ExecuteNonQuery(@"
+ // insert into umbracoApp
+ // (appAlias,appIcon,appName, sortOrder)
+ // values (@alias,@icon,@name,@sortOrder)",
+ // SqlHelper.CreateParameter("@alias", alias),
+ // SqlHelper.CreateParameter("@icon", icon),
+ // SqlHelper.CreateParameter("@name", name),
+ // SqlHelper.CreateParameter("@sortOrder", sortOrder));
LoadXml(doc =>
{
@@ -212,7 +220,7 @@ namespace umbraco.BusinessLogic
// MakeNew(Iapp.Name, Iapp.Alias, Iapp.Icon);
// if (installAppTrees) {
-
+
// }
//}
@@ -222,14 +230,15 @@ namespace umbraco.BusinessLogic
///
/// The application alias.
///
- public static Application getByAlias(string appAlias) {
+ public static Application getByAlias(string appAlias)
+ {
return Apps.Find(t => t.alias == appAlias);
}
///
/// Deletes this instance.
///
- public void Delete()
+ public void Delete()
{
//delete the assigned applications
SqlHelper.ExecuteNonQuery("delete from umbracoUser2App where app = @appAlias", SqlHelper.CreateParameter("@appAlias", this.alias));
@@ -273,22 +282,22 @@ namespace umbraco.BusinessLogic
///
private static void ReCache()
{
- HttpRuntime.Cache.Remove(CACHE_KEY);
- Cache();
+ HttpRuntime.Cache.Remove(CacheKey);
+ EnsureCache();
}
///
/// Read all Application data and store it in cache.
///
- private static void Cache()
+ private static void EnsureCache()
{
//don't query the database is the cache is not null
- if (HttpRuntime.Cache[CACHE_KEY] != null)
+ if (HttpRuntime.Cache[CacheKey] != null)
return;
try
{
- List tmp = new List();
+ var tmp = new List();
//using (IRecordsReader dr =
// SqlHelper.ExecuteReader("Select appAlias, appIcon, appName from umbracoApp"))
@@ -299,13 +308,14 @@ namespace umbraco.BusinessLogic
// }
//}
- LoadXml(doc => {
+ LoadXml(doc =>
+ {
foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
- {
- var sortOrderAttr = x.Attribute("sortOrder");
- return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
- }))
+ {
+ var sortOrderAttr = x.Attribute("sortOrder");
+ return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
+ }))
{
var sortOrderAttr = addElement.Attribute("sortOrder");
tmp.Add(new Application(addElement.Attribute("name").Value,
@@ -324,16 +334,18 @@ namespace umbraco.BusinessLogic
//installer is run and there is no database or connection string defined.
//the reason this method may get called during the installation is that the
//SqlHelper of this class is shared amongst everything "Application" wide.
+
+ //TODO: Perhaps we should log something here??
}
}
internal static void LoadXml(Action callback, bool saveAfterCallback)
{
- lock (m_Locker)
+ lock (Locker)
{
- var doc = File.Exists(_appConfig)
- ? XDocument.Load(_appConfig)
+ var doc = File.Exists(AppConfigFilePath)
+ ? XDocument.Load(AppConfigFilePath)
: XDocument.Parse("");
if (doc.Root != null)
@@ -342,7 +354,10 @@ namespace umbraco.BusinessLogic
if (saveAfterCallback)
{
- doc.Save(_appConfig);
+ //ensure the folder is created!
+ Directory.CreateDirectory(Path.GetDirectoryName(AppConfigFilePath));
+
+ doc.Save(AppConfigFilePath);
ReCache();
}
@@ -350,73 +365,4 @@ namespace umbraco.BusinessLogic
}
}
}
-
- public enum DefaultApps
- {
- content,
- media,
- users,
- settings,
- developer,
- member,
- translation
- }
-
- public class ApplicationRegistrar : ApplicationStartupHandler
- {
- private ISqlHelper _sqlHelper;
- protected ISqlHelper SqlHelper
- {
- get
- {
- if (_sqlHelper == null)
- {
- try
- {
- _sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
- }
- catch { }
- }
- return _sqlHelper;
- }
- }
-
- public ApplicationRegistrar()
- {
- // Load all Applications by attribute and add them to the XML config
- var types = TypeFinder.FindClassesOfType()
- .Where(x => x.GetCustomAttributes(typeof(ApplicationAttribute), false).Any());
-
- var attrs = types.Select(x => (ApplicationAttribute)x.GetCustomAttributes(typeof(ApplicationAttribute), false).Single())
- .Where(x => Application.getByAlias(x.Alias) == null);
-
- var allAliases = Application.getAll().Select(x => x.alias).Concat(attrs.Select(x => x.Alias));
- var inString = "'" + string.Join("','", allAliases) + "'";
-
- Application.LoadXml(doc =>
- {
- foreach (var attr in attrs)
- {
- doc.Root.Add(new XElement("add",
- new XAttribute("alias", attr.Alias),
- new XAttribute("name", attr.Name),
- new XAttribute("icon", attr.Icon),
- new XAttribute("sortOrder", attr.SortOrder)));
- }
-
- var dbApps = SqlHelper.ExecuteReader("SELECT * FROM umbracoApp WHERE appAlias NOT IN ("+ inString +")");
- while (dbApps.Read())
- {
- doc.Root.Add(new XElement("add",
- new XAttribute("alias", dbApps.GetString("appAlias")),
- new XAttribute("name", dbApps.GetString("appName")),
- new XAttribute("icon", dbApps.GetString("appIcon")),
- new XAttribute("sortOrder", dbApps.GetByte("sortOrder"))));
- }
-
- }, true);
-
- //SqlHelper.ExecuteNonQuery("DELETE FROM umbracoApp");
- }
- }
}
diff --git a/src/umbraco.businesslogic/ApplicationTree.cs b/src/umbraco.businesslogic/ApplicationTree.cs
index 2c4cfb4bf4..ea00435030 100644
--- a/src/umbraco.businesslogic/ApplicationTree.cs
+++ b/src/umbraco.businesslogic/ApplicationTree.cs
@@ -5,11 +5,8 @@ using System.Linq;
using System.Text;
using System.Web;
using System.Xml.Linq;
-using umbraco.BusinessLogic.Utils;
using umbraco.DataLayer;
using umbraco.IO;
-using umbraco.businesslogic;
-using umbraco.interfaces;
namespace umbraco.BusinessLogic
{
@@ -21,12 +18,29 @@ namespace umbraco.BusinessLogic
public class ApplicationTree
{
- private const string CACHE_KEY = "ApplicationTreeCache";
+ private const string CacheKey = "ApplicationTreeCache";
+ internal const string TreeConfigFileName = "trees.config";
+ private static string _treeConfig;
+ private static readonly object Locker = new object();
- private static readonly string _appTreeConfig =
- IOHelper.MapPath(SystemDirectories.Config + "/trees.config");
-
- private static readonly object m_Locker = new object();
+ ///
+ /// gets/sets the trees.config file path
+ ///
+ ///
+ /// The setter is generally only going to be used in unit tests, otherwise it will attempt to resolve it using the IOHelper.MapPath
+ ///
+ internal static string TreeConfigFilePath
+ {
+ get
+ {
+ if (string.IsNullOrWhiteSpace(_treeConfig))
+ {
+ _treeConfig = IOHelper.MapPath(SystemDirectories.Config + "/" + TreeConfigFileName);
+ }
+ return _treeConfig;
+ }
+ set { _treeConfig = value; }
+ }
///
/// The cache storage for all application trees
@@ -36,13 +50,12 @@ namespace umbraco.BusinessLogic
get
{
//ensure cache exists
- if (HttpRuntime.Cache[CACHE_KEY] == null)
- ReCache();
- return HttpRuntime.Cache[CACHE_KEY] as List;
+ EnsureCache();
+ return HttpRuntime.Cache[CacheKey] as List;
}
set
{
- HttpRuntime.Cache.Insert(CACHE_KEY, value);
+ HttpRuntime.Cache.Insert(CacheKey, value);
}
}
@@ -175,14 +188,6 @@ namespace umbraco.BusinessLogic
set { _action = value; }
}
- ///
- /// A static constructor that will cache all application trees
- ///
- static ApplicationTree()
- {
- Cache();
- }
-
///
/// Initializes a new instance of the class.
///
@@ -236,22 +241,22 @@ namespace umbraco.BusinessLogic
public static void MakeNew(bool silent, bool initialize, byte sortOrder, string applicationAlias, string alias, string title, string iconClosed, string iconOpened, string assemblyName, string type, string action)
{
-// SqlHelper.ExecuteNonQuery(@"insert into umbracoAppTree(treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle,
-// treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType, action)
-// values(@treeSilent, @treeInitialize, @treeSortOrder, @appAlias, @treeAlias, @treeTitle, @treeIconClosed, @treeIconOpen, @treeHandlerAssembly, @treeHandlerType, @action)"
-// ,
-// SqlHelper.CreateParameter("@treeSilent", silent),
-// SqlHelper.CreateParameter("@treeInitialize", initialize),
-// SqlHelper.CreateParameter("@treeSortOrder", sortOrder),
-// SqlHelper.CreateParameter("@treeAlias", alias),
-// SqlHelper.CreateParameter("@appAlias", applicationAlias),
-// SqlHelper.CreateParameter("@treeTitle", title),
-// SqlHelper.CreateParameter("@treeIconClosed", iconClosed),
-// SqlHelper.CreateParameter("@treeIconOpen", iconOpened),
-// SqlHelper.CreateParameter("@treeHandlerAssembly", assemblyName),
-// SqlHelper.CreateParameter("@treeHandlerType", type),
-// SqlHelper.CreateParameter("@action", action)
-// );
+ // SqlHelper.ExecuteNonQuery(@"insert into umbracoAppTree(treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle,
+ // treeIconClosed, treeIconOpen, treeHandlerAssembly, treeHandlerType, action)
+ // values(@treeSilent, @treeInitialize, @treeSortOrder, @appAlias, @treeAlias, @treeTitle, @treeIconClosed, @treeIconOpen, @treeHandlerAssembly, @treeHandlerType, @action)"
+ // ,
+ // SqlHelper.CreateParameter("@treeSilent", silent),
+ // SqlHelper.CreateParameter("@treeInitialize", initialize),
+ // SqlHelper.CreateParameter("@treeSortOrder", sortOrder),
+ // SqlHelper.CreateParameter("@treeAlias", alias),
+ // SqlHelper.CreateParameter("@appAlias", applicationAlias),
+ // SqlHelper.CreateParameter("@treeTitle", title),
+ // SqlHelper.CreateParameter("@treeIconClosed", iconClosed),
+ // SqlHelper.CreateParameter("@treeIconOpen", iconOpened),
+ // SqlHelper.CreateParameter("@treeHandlerAssembly", assemblyName),
+ // SqlHelper.CreateParameter("@treeHandlerType", type),
+ // SqlHelper.CreateParameter("@action", action)
+ // );
LoadXml(doc =>
{
@@ -275,27 +280,27 @@ namespace umbraco.BusinessLogic
///
public void Save()
{
-// SqlHelper.ExecuteNonQuery(@"Update umbracoAppTree set treeSilent = @treeSilent, treeInitialize = @treeInitialize, treeSortOrder = @treeSortOrder, treeTitle = @treeTitle,
-// treeIconClosed = @treeIconClosed, treeIconOpen = @treeIconOpen, treeHandlerAssembly = @treeHandlerAssembly, treeHandlerType = @treeHandlerType, action = @action
-// where treeAlias = @treeAlias AND appAlias = @appAlias",
-// SqlHelper.CreateParameter("@treeSilent", this.Silent),
-// SqlHelper.CreateParameter("@treeInitialize", this.Initialize),
-// SqlHelper.CreateParameter("@treeSortOrder", this.SortOrder),
-// SqlHelper.CreateParameter("@treeTitle", this.Title),
-// SqlHelper.CreateParameter("@treeIconClosed", this.IconClosed),
-// SqlHelper.CreateParameter("@treeIconOpen", this.IconOpened),
-// SqlHelper.CreateParameter("@treeHandlerAssembly", this.AssemblyName),
-// SqlHelper.CreateParameter("@treeHandlerType", this.Type),
-// SqlHelper.CreateParameter("@treeAlias", this.Alias),
-// SqlHelper.CreateParameter("@appAlias", this.ApplicationAlias),
-// SqlHelper.CreateParameter("@action", this.Action)
-// );
+ // SqlHelper.ExecuteNonQuery(@"Update umbracoAppTree set treeSilent = @treeSilent, treeInitialize = @treeInitialize, treeSortOrder = @treeSortOrder, treeTitle = @treeTitle,
+ // treeIconClosed = @treeIconClosed, treeIconOpen = @treeIconOpen, treeHandlerAssembly = @treeHandlerAssembly, treeHandlerType = @treeHandlerType, action = @action
+ // where treeAlias = @treeAlias AND appAlias = @appAlias",
+ // SqlHelper.CreateParameter("@treeSilent", this.Silent),
+ // SqlHelper.CreateParameter("@treeInitialize", this.Initialize),
+ // SqlHelper.CreateParameter("@treeSortOrder", this.SortOrder),
+ // SqlHelper.CreateParameter("@treeTitle", this.Title),
+ // SqlHelper.CreateParameter("@treeIconClosed", this.IconClosed),
+ // SqlHelper.CreateParameter("@treeIconOpen", this.IconOpened),
+ // SqlHelper.CreateParameter("@treeHandlerAssembly", this.AssemblyName),
+ // SqlHelper.CreateParameter("@treeHandlerType", this.Type),
+ // SqlHelper.CreateParameter("@treeAlias", this.Alias),
+ // SqlHelper.CreateParameter("@appAlias", this.ApplicationAlias),
+ // SqlHelper.CreateParameter("@action", this.Action)
+ // );
LoadXml(doc =>
{
var el = doc.Root.Elements("add").SingleOrDefault(x => x.Attribute("alias").Value == this.Alias && x.Attribute("application").Value == this.ApplicationAlias);
- if(el != null)
+ if (el != null)
{
el.RemoveAttributes();
@@ -326,7 +331,7 @@ namespace umbraco.BusinessLogic
LoadXml(doc =>
{
- doc.Root.Elements("add").Where(x => x.Attribute("application") != null && x.Attribute("application").Value == this.ApplicationAlias &&
+ doc.Root.Elements("add").Where(x => x.Attribute("application") != null && x.Attribute("application").Value == this.ApplicationAlias &&
x.Attribute("alias") != null && x.Attribute("alias").Value == this.Alias).Remove();
}, true);
}
@@ -393,82 +398,81 @@ namespace umbraco.BusinessLogic
///
private static void ReCache()
{
- HttpRuntime.Cache.Remove(CACHE_KEY);
- Cache();
+ HttpRuntime.Cache.Remove(CacheKey);
+ EnsureCache();
}
///
/// Read all ApplicationTree data and store it in cache.
///
- private static void Cache()
+ private static void EnsureCache()
{
//don't query the database if the cache is not null
- if (HttpRuntime.Cache[CACHE_KEY] == null)
+ if (HttpRuntime.Cache[CacheKey] != null)
+ return;
+
+ lock (Locker)
{
- lock (m_Locker)
+ if (HttpRuntime.Cache[CacheKey] == null)
{
- if (HttpRuntime.Cache[CACHE_KEY] == null)
+ var list = new List();
+
+ // using (IRecordsReader dr = SqlHelper.ExecuteReader(@"Select treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed,
+ // treeIconOpen, treeHandlerAssembly, treeHandlerType, action from umbracoAppTree order by treeSortOrder"))
+ // {
+ // while (dr.Read())
+ // {
+
+ // list.Add(new ApplicationTree(
+ // dr.GetBoolean("treeSilent"),
+ // dr.GetBoolean("treeInitialize"),
+ // dr.GetByte("treeSortOrder"),
+ // dr.GetString("appAlias"),
+ // dr.GetString("treeAlias"),
+ // dr.GetString("treeTitle"),
+ // dr.GetString("treeIconClosed"),
+ // dr.GetString("treeIconOpen"),
+ // dr.GetString("treeHandlerAssembly"),
+ // dr.GetString("treeHandlerType"),
+ // dr.GetString("action")));
+
+ // }
+ // }
+
+ LoadXml(doc =>
{
- List list = new List();
-
-// using (IRecordsReader dr = SqlHelper.ExecuteReader(@"Select treeSilent, treeInitialize, treeSortOrder, appAlias, treeAlias, treeTitle, treeIconClosed,
-// treeIconOpen, treeHandlerAssembly, treeHandlerType, action from umbracoAppTree order by treeSortOrder"))
-// {
-// while (dr.Read())
-// {
-
-// list.Add(new ApplicationTree(
-// dr.GetBoolean("treeSilent"),
-// dr.GetBoolean("treeInitialize"),
-// dr.GetByte("treeSortOrder"),
-// dr.GetString("appAlias"),
-// dr.GetString("treeAlias"),
-// dr.GetString("treeTitle"),
-// dr.GetString("treeIconClosed"),
-// dr.GetString("treeIconOpen"),
-// dr.GetString("treeHandlerAssembly"),
-// dr.GetString("treeHandlerType"),
-// dr.GetString("action")));
-
-// }
-// }
-
- LoadXml(doc =>
+ foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
{
- foreach (var addElement in doc.Root.Elements("add").OrderBy(x =>
- {
- var sortOrderAttr = x.Attribute("sortOrder");
- return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
- }))
- {
- list.Add(new ApplicationTree(
- addElement.Attribute("silent") != null ? Convert.ToBoolean(addElement.Attribute("silent").Value) : false,
- addElement.Attribute("initialize") != null ? Convert.ToBoolean(addElement.Attribute("initialize").Value) : true,
- addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte)0,
- addElement.Attribute("application").Value,
- addElement.Attribute("alias").Value,
- addElement.Attribute("title").Value,
- addElement.Attribute("iconClosed").Value,
- addElement.Attribute("iconOpen").Value,
- addElement.Attribute("assembly").Value,
- addElement.Attribute("type").Value,
- addElement.Attribute("action") != null ? addElement.Attribute("action").Value : ""));
- }
- }, false);
+ var sortOrderAttr = x.Attribute("sortOrder");
+ return sortOrderAttr != null ? Convert.ToInt32(sortOrderAttr.Value) : 0;
+ }))
+ {
+ list.Add(new ApplicationTree(
+ addElement.Attribute("silent") != null ? Convert.ToBoolean(addElement.Attribute("silent").Value) : false,
+ addElement.Attribute("initialize") != null ? Convert.ToBoolean(addElement.Attribute("initialize").Value) : true,
+ addElement.Attribute("sortOrder") != null ? Convert.ToByte(addElement.Attribute("sortOrder").Value) : (byte)0,
+ addElement.Attribute("application").Value,
+ addElement.Attribute("alias").Value,
+ addElement.Attribute("title").Value,
+ addElement.Attribute("iconClosed").Value,
+ addElement.Attribute("iconOpen").Value,
+ addElement.Attribute("assembly").Value,
+ addElement.Attribute("type").Value,
+ addElement.Attribute("action") != null ? addElement.Attribute("action").Value : ""));
+ }
+ }, false);
- AppTrees = list;
- }
+ AppTrees = list;
}
}
-
}
internal static void LoadXml(Action callback, bool saveAfterCallback)
{
- lock (m_Locker)
+ lock (Locker)
{
- var doc = File.Exists(_appTreeConfig)
- ? XDocument.Load(_appTreeConfig)
+ var doc = File.Exists(TreeConfigFilePath)
+ ? XDocument.Load(TreeConfigFilePath)
: XDocument.Parse("");
if (doc.Root != null)
{
@@ -476,7 +480,9 @@ namespace umbraco.BusinessLogic
if (saveAfterCallback)
{
- doc.Save(_appTreeConfig);
+ Directory.CreateDirectory(Path.GetDirectoryName(TreeConfigFilePath));
+
+ doc.Save(TreeConfigFilePath);
ReCache();
}
@@ -484,86 +490,4 @@ namespace umbraco.BusinessLogic
}
}
}
-
- public class ApplicationTreeRegistrar : ApplicationStartupHandler
- {
- private ISqlHelper _sqlHelper;
- protected ISqlHelper SqlHelper
- {
- get
- {
- if (_sqlHelper == null)
- {
- try
- {
- _sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
- }
- catch { }
- }
- return _sqlHelper;
- }
- }
-
- public ApplicationTreeRegistrar()
- {
- // Load all Applications by attribute and add them to the XML config
- var types = TypeFinder.FindClassesOfType()
- .Where(x => x.GetCustomAttributes(typeof(TreeAttribute), false).Any());
-
- var items = types.Select(x => new Tuple(x,
- (TreeAttribute)x.GetCustomAttributes(typeof(TreeAttribute), false).Single()))
- .Where(x => ApplicationTree.getByAlias(x.Item2.Alias) == null);
-
- var allAliases = ApplicationTree.getAll().Select(x => x.Alias).Concat(items.Select(x => x.Item2.Alias));
- var inString = "'" + string.Join("','", allAliases) + "'";
-
- ApplicationTree.LoadXml(doc =>
- {
- foreach (var tuple in items)
- {
- var type = tuple.Item1;
- var attr = tuple.Item2;
-
- var typeParts = type.AssemblyQualifiedName.Split(',');
- var assemblyName = typeParts[1].Trim();
- var typeName = typeParts[0].Substring(assemblyName.Length + 1).Trim();
-
- doc.Root.Add(new XElement("add",
- new XAttribute("silent", attr.Silent),
- new XAttribute("initialize", attr.Initialize),
- new XAttribute("sortOrder", attr.SortOrder),
- new XAttribute("alias", attr.Alias),
- new XAttribute("application", attr.ApplicationAlias),
- new XAttribute("title", attr.Title),
- new XAttribute("iconClosed", attr.IconClosed),
- new XAttribute("iconOpen", attr.IconOpen),
- new XAttribute("assembly", assemblyName),
- new XAttribute("type", typeName),
- new XAttribute("action", attr.Action)));
- }
-
- var dbTrees = SqlHelper.ExecuteReader("SELECT * FROM umbracoAppTree WHERE treeAlias NOT IN (" + inString + ")");
- while(dbTrees.Read())
- {
- var action = dbTrees.GetString("action");
-
- doc.Root.Add(new XElement("add",
- new XAttribute("silent", dbTrees.GetBoolean("treeSilent")),
- new XAttribute("initialize", dbTrees.GetBoolean("treeInitialize")),
- new XAttribute("sortOrder", dbTrees.GetByte("treeSortOrder")),
- new XAttribute("alias", dbTrees.GetString("treeAlias")),
- new XAttribute("application", dbTrees.GetString("appAlias")),
- new XAttribute("title", dbTrees.GetString("treeTitle")),
- new XAttribute("iconClosed", dbTrees.GetString("treeIconClosed")),
- new XAttribute("iconOpen", dbTrees.GetString("treeIconOpen")),
- new XAttribute("assembly", dbTrees.GetString("treeHandlerAssembly")),
- new XAttribute("type", dbTrees.GetString("treeHandlerType")),
- new XAttribute("action", string.IsNullOrEmpty(action) ? "" : action)));
- }
-
- }, true);
-
- //SqlHelper.ExecuteNonQuery("DELETE FROM umbracoAppTree");
- }
- }
}
diff --git a/src/umbraco.businesslogic/umbraco.businesslogic.csproj b/src/umbraco.businesslogic/umbraco.businesslogic.csproj
index 6f8220ad28..b4bfe1530c 100644
--- a/src/umbraco.businesslogic/umbraco.businesslogic.csproj
+++ b/src/umbraco.businesslogic/umbraco.businesslogic.csproj
@@ -140,8 +140,11 @@
+
+
+
Code
diff --git a/src/umbraco.presentation/web.config b/src/umbraco.presentation/web.config
index 414084d4a0..6200875464 100644
--- a/src/umbraco.presentation/web.config
+++ b/src/umbraco.presentation/web.config
@@ -22,7 +22,7 @@
-
+
@@ -33,7 +33,7 @@
-
+
@@ -65,7 +65,7 @@
-
+
@@ -104,7 +104,7 @@
-
+