Removes all references to the legacy Document.RepublishAll and replaces it's logic with the correct logic.

This commit is contained in:
Shannon
2013-07-29 16:45:54 +10:00
parent eed61f9053
commit 5b26436862
2 changed files with 2 additions and 42 deletions

View File

@@ -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") != "")

View File

@@ -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<Document>("Error generating xml", ee);
}
}
dr.Close();
ApplicationContext.Current.Services.ContentService.RePublishAll();
}
public static void RegeneratePreviews()