Merge pull request #1393 from umbraco/temp-U4-8755

U4-8755 - more explicit errors when xml cache is corrupt
This commit is contained in:
Warren Buckley
2016-07-22 11:47:17 +01:00
committed by GitHub
5 changed files with 37 additions and 19 deletions

View File

@@ -147,7 +147,8 @@
<key alias="nodeName">Page Title</key>
<key alias="otherElements">Properties</key>
<key alias="parentNotPublished">This document is published but is not visible because the parent '%0%' is unpublished</key>
<key alias="parentNotPublishedAnomaly">Oops: this document is published but is not in the cache (internal error)</key>
<key alias="parentNotPublishedAnomaly">Oops: this document is published but is not in the cache (internal error - see log)</key>
<key alias="getUrlException">Oops: could not get the url (internal error - see log)</key>
<key alias="routeError">Oops: this document is published but its url would collide with content %0%</key>
<key alias="publish">Publish</key>
<key alias="publishStatus">Publication Status</key>
@@ -789,7 +790,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="installStateInstalling">Installing...</key>
<key alias="installStateRestarting">Restarting, please wait...</key>
<key alias="installStateComplete">All done, your browser will now refresh, please wait...</key>
</area>
<area alias="paste">
<key alias="doNothing">Paste with full formatting (Not recommended)</key>
@@ -1294,38 +1295,38 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="checkSuccessMessage">Value is set to the recommended value: '%0%'.</key>
<key alias="rectifySuccessMessage">Value was set to '%1%' for XPath '%2%' in configuration file '%3%'.</key>
<key alias="checkErrorMessageDifferentExpectedValue">Expected value '%1%' for '%2%' in configuration file '%3%', but found '%0%'.</key>
<key alias="checkErrorMessageUnexpectedValue">Found unexpected value '%0%' for '%2%' in configuration file '%3%'.</key>
<key alias="checkErrorMessageUnexpectedValue">Found unexpected value '%0%' for '%2%' in configuration file '%3%'.</key>
<!-- The following keys get these tokens passed in:
0: Current value
1: Recommended value
-->
-->
<key alias="customErrorsCheckSuccessMessage">Custom errors are set to '%0%'.</key>
<key alias="customErrorsCheckErrorMessage">Custom errors are currently set to '%0%'. It is recommended to set this to '%1%' before go live.</key>
<key alias="customErrorsCheckRectifySuccessMessage">Custom errors successfully set to '%0%'.</key>
<key alias="macroErrorModeCheckSuccessMessage">MacroErrors are set to '%0%'.</key>
<key alias="macroErrorModeCheckErrorMessage">MacroErrors are set to '%0%' which will prevent some or all pages in your site from loading completely when there's any errors in macros. Rectifying this will set the value to '%1%'.</key>
<key alias="macroErrorModeCheckRectifySuccessMessage">MacroErrors are now set to '%0%'.</key>
<!-- The following keys get these tokens passed in:
0: Current value
1: Recommended value
2: Server version
-->
-->
<key alias="trySkipIisCustomErrorsCheckSuccessMessage">Try Skip IIS Custom Errors is set to '%0%' and you're using IIS version '%1%'.</key>
<key alias="trySkipIisCustomErrorsCheckErrorMessage">Try Skip IIS Custom Errors is currently '%0%'. It is recommended to set this to '%1%' for your IIS version (%2%).</key>
<key alias="trySkipIisCustomErrorsCheckRectifySuccessMessage">Try Skip IIS Custom Errors successfully set to '%0%'.</key>
<!-- The following keys get predefined tokens passed in that are not all the same, like above -->
<key alias="configurationServiceFileNotFound">File does not exist: '%0%'.</key>
<key alias="configurationServiceNodeNotFound"><![CDATA[Unable to find <strong>'%0%'</strong> in config file <strong>'%1%'</strong>.]]></key>
<key alias="configurationServiceError">There was an error, check log for full error: %0%.</key>
<key alias="xmlDataIntegrityCheckMembers">Total XML: %0%, Total: %1%</key>
<key alias="xmlDataIntegrityCheckMedia">Total XML: %0%, Total: %1%</key>
<key alias="xmlDataIntegrityCheckContent">Total XML: %0%, Total published: %1%</key>
<key alias="httpsCheckInvalidCertificate">Certificate validation error: '%0%'</key>
<key alias="httpsCheckInvalidUrl">Error pinging the URL %0% - '%1%'</key>
<key alias="httpsCheckIsCurrentSchemeHttps">You are currently %0% viewing the site using the HTTPS scheme.</key>
@@ -1337,12 +1338,12 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="httpsCheckEnableHttpsButton">Enable HTTPS</key>
<key alias="httpsCheckEnableHttpsDescription">Sets umbracoSSL setting to true in the appSettings of the web.config file.</key>
<key alias="httpsCheckEnableHttpsSuccess">The appSetting 'umbracoUseSSL' is now set to 'true' in your web.config file, your cookies will be marked as secure.</key>
<key alias="rectifyButton">Fix</key>
<key alias="cannotRectifyShouldNotEqual">Cannot fix a check with a value comparison type of 'ShouldNotEqual'.</key>
<key alias="cannotRectifyShouldEqualWithValue">Cannot fix a check with a value comparison type of 'ShouldEqual' with a provided value.</key>
<key alias="valueToRectifyNotProvided">Value to fix check not provided.</key>
<key alias="compilationDebugCheckSuccessMessage">Debug compilation mode is disabled.</key>
<key alias="compilationDebugCheckErrorMessage">Debug compilation mode is currently enabled. It is recommended to disable this setting before go live.</key>
<key alias="compilationDebugCheckRectifySuccessMessage">Debug compilation mode successfully disabled.</key>
@@ -1364,7 +1365,7 @@ To manage your website, simply open the Umbraco back office and start adding con
-->
<key alias="requiredFilePermissionFailed"><![CDATA[The following files must be set up with write permissions but could not be acccessed: <strong>%0%</strong>.]]></key>
<key alias="optionalFilePermissionFailed"><![CDATA[The following files must be set up with write permissions for certain Umbraco operations to function but could not be acccessed: <strong>%0%</strong>. If they aren't being written to no action need be taken.]]></key>
<key alias="clickJackingCheckHeaderFound"><![CDATA[The header or meta-tag <strong>X-Frame-Options</strong> used to control whether a site can be IFRAMed by another was found.]]></key>
<key alias="clickJackingCheckHeaderNotFound"><![CDATA[The header or meta-tag <strong>X-Frame-Options</strong> used to control whether a site can be IFRAMed by another was not found.]]></key>
<key alias="clickJackingSetHeaderInConfig">Set Header in Config</key>
@@ -1385,5 +1386,5 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="notificationEmailsCheckSuccessMessage"><![CDATA[Notification email has been set to <strong>%0%</strong>.]]></key>
<key alias="notificationEmailsCheckErrorMessage"><![CDATA[Notification email is still set to the default value of <strong>%0%</strong>.]]></key>
</area>
</area>
</language>

View File

@@ -148,7 +148,8 @@
<key alias="nodeName">Page Title</key>
<key alias="otherElements">Properties</key>
<key alias="parentNotPublished">This document is published but is not visible because the parent '%0%' is unpublished</key>
<key alias="parentNotPublishedAnomaly">Oops: this document is published but is not in the cache (internal error)</key>
<key alias="parentNotPublishedAnomaly">Oops: this document is published but is not in the cache (internal error - see log)</key>
<key alias="getUrlException">Oops: could not get the url (internal error - see log)</key>
<key alias="routeError">Oops: this document is published but its url would collide with content %0%</key>
<key alias="publish">Publish</key>
<key alias="publishStatus">Publication Status</key>

View File

@@ -409,7 +409,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
internal XmlDocument GetXml(UmbracoContext umbracoContext, bool preview)
{
return GetXmlDelegate(umbracoContext, preview);
var xml = GetXmlDelegate(umbracoContext, preview);
if (xml == null)
throw new Exception("The Xml cache is corrupt. Use the Health Check data integrity dashboard to fix it.");
return xml;
}
#endregion

View File

@@ -8,7 +8,6 @@ using Umbraco.Web.Routing;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Cache;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Web.Cache;

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using Umbraco.Core.Models;
using umbraco;
using Umbraco.Core.Logging;
namespace Umbraco.Web.Routing
{
@@ -30,8 +31,17 @@ namespace Umbraco.Web.Routing
return urls;
}
string url;
var urlProvider = umbracoContext.RoutingContext.UrlProvider;
var url = urlProvider.GetUrl(content.Id);
try
{
url = urlProvider.GetUrl(content.Id);
}
catch (Exception e)
{
LogHelper.Error<UrlProvider>("GetUrl exception.", e);
url = "#ex";
}
if (url == "#")
{
// document as a published version yet it's url is "#" => a parent must be
@@ -48,6 +58,10 @@ namespace Umbraco.Web.Routing
else
urls.Add(ui.Text("content", "parentNotPublished", parent.Name, umbracoContext.Security.CurrentUser));
}
else if (url == "#ex")
{
urls.Add(ui.Text("content", "getUrlException", umbracoContext.Security.CurrentUser));
}
else if (url.StartsWith("#err-"))
{
// route error, report