Fixes issue with upgrading - potential file lock issues and also file check for access.config

Conflicts:
	src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs
This commit is contained in:
Shannon
2015-07-08 11:13:24 +02:00
parent 45bec2a67d
commit 2600a3887e
2 changed files with 15 additions and 12 deletions

View File

@@ -98,7 +98,7 @@ namespace Umbraco.Web.Install
// that and we might get lock issues.
try
{
var xmlFile = content.Instance.UmbracoXmlDiskCacheFileName + ".tmp";
var xmlFile = content.GetUmbracoXmlDiskFileName() + ".tmp";
SaveAndDeleteFile(xmlFile);
return true;
}

View File

@@ -127,23 +127,26 @@ namespace umbraco
private static readonly object DbReadSyncLock = new object();
private const string XmlContextContentItemKey = "UmbracoXmlContextContent";
private string _umbracoXmlDiskCacheFileName = string.Empty;
private static string _umbracoXmlDiskCacheFileName = string.Empty;
private volatile XmlDocument _xmlContent;
/// <summary>
/// Gets the path of the umbraco XML disk cache file.
/// </summary>
/// <value>The name of the umbraco XML disk cache file.</value>
public static string GetUmbracoXmlDiskFileName()
{
if (string.IsNullOrEmpty(_umbracoXmlDiskCacheFileName))
{
_umbracoXmlDiskCacheFileName = IOHelper.MapPath(SystemFiles.ContentCacheXml);
}
return _umbracoXmlDiskCacheFileName;
}
[Obsolete("Use the safer static GetUmbracoXmlDiskFileName() method instead to retrieve this value")]
public string UmbracoXmlDiskCacheFileName
{
get
{
if (string.IsNullOrEmpty(_umbracoXmlDiskCacheFileName))
{
_umbracoXmlDiskCacheFileName = IOHelper.MapPath(SystemFiles.ContentCacheXml);
}
return _umbracoXmlDiskCacheFileName;
}
get { return GetUmbracoXmlDiskFileName(); }
set { _umbracoXmlDiskCacheFileName = value; }
}
@@ -669,9 +672,9 @@ order by umbracoNode.level, umbracoNode.sortOrder";
{
//TODO: Should there be a try/catch here in case the file is being written to while this is trying to be executed?
if (File.Exists(UmbracoXmlDiskCacheFileName))
if (File.Exists(GetUmbracoXmlDiskFileName()))
{
return new FileInfo(UmbracoXmlDiskCacheFileName).LastWriteTimeUtc;
return new FileInfo(GetUmbracoXmlDiskFileName()).LastWriteTimeUtc;
}
return DateTime.MinValue;