From 5b26436862a16ffd020f46adec874a85ddbb424c Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 29 Jul 2013 16:45:54 +1000 Subject: [PATCH] Removes all references to the legacy Document.RepublishAll and replaces it's logic with the correct logic. --- .../umbraco/dialogs/republish.aspx.cs | 1 + src/umbraco.cms/businesslogic/web/Document.cs | 43 +------------------ 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs index 23ce0cd650..791ea13d40 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs @@ -27,6 +27,7 @@ namespace umbraco.cms.presentation if (Request.GetItemAsString("xml") != "") { Server.ScriptTimeout = 100000; + Services.ContentService.RePublishAll(); umbraco.cms.businesslogic.web.Document.RePublishAll(); } else if (Request.GetItemAsString("previews") != "") diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 724ca09b34..66e6db5080 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -428,48 +428,7 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentService.RePublishAll()", false)] public static void RePublishAll() { - var xd = new XmlDocument(); - - //Remove all Documents (not media or members), only Documents are stored in the cmsDocument table - SqlHelper.ExecuteNonQuery(@"DELETE FROM cmsContentXml WHERE nodeId IN - (SELECT DISTINCT cmsContentXml.nodeId FROM cmsContentXml - INNER JOIN cmsDocument ON cmsContentXml.nodeId = cmsDocument.nodeId)"); - - var dr = SqlHelper.ExecuteReader("select nodeId from cmsDocument where published = 1"); - - while (dr.Read()) - { - try - { - //create the document in optimized mode! - // (not sure why we wouldn't always do that ?!) - - new Document(true, dr.GetInt("nodeId")) - .XmlGenerate(xd); - - //The benchmark results that I found based contructing the Document object with 'true' for optimized - //mode, vs using the normal ctor. Clearly optimized mode is better! - /* - * The average page rendering time (after 10 iterations) for submitting /umbraco/dialogs/republish?xml=true when using - * optimized mode is - * - * 0.060400555555556 - * - * The average page rendering time (after 10 iterations) for submitting /umbraco/dialogs/republish?xml=true when not - * using optimized mode is - * - * 0.107037777777778 - * - * This means that by simply changing this to use optimized mode, it is a 45% improvement! - * - */ - } - catch (Exception ee) - { - LogHelper.Error("Error generating xml", ee); - } - } - dr.Close(); + ApplicationContext.Current.Services.ContentService.RePublishAll(); } public static void RegeneratePreviews()