Hi. I've just tried to check a supposition of mine and realised that "republish entire site" doesn't refresh the cmsContentXml table. I've already had a little problem with this once when for some strange reason the content of this table went desynchronised with some document properties. Is there any mean to force refreshing of this table otherwise than complete unpublishing/publishing of documents? (what's worse is that it seems that this unpublishing/publishing should be done for every separate document).
I don't think there's an easy solution for this. I think it's best to get all the nodes of a certain type and republish them in a script or something. Here's how you can republish all media which will also update the cmsContentXml table:
string sql = @"
select un.id
from umbracoNode un
where un.nodeObjectType = @type";
//Get all the media items.
using (IRecordsReader dr = SqlHelper.ExecuteReader(sql, SqlHelper.CreateParameter("@type", Media._objectType)))
{
//Loop trough all the media items.
while (dr.Read())
{
//Get the id of a media item.
int mediaId = dr.GetInt("id");
//Call the save method to update the cmsContentXml and call all events.
Media media = new Media(mediaId);
media.Save();
media.XmlGenerate(new XmlDocument());
}
}
Wow. Thanks for the info. Now that's far much clearer for me. Perhaps it would be a good idea to put a checkbox to the standard "republish entire site" dialog so that to optionally include the "RePublishAll()" call into the process of republishing - to summon this dialog manually with "?xml=true" looks a bit hackish.
I've created a very simple package that replaces the "republish.aspx" dialog with one that allows to optionally turn on refreshing the "cmsContentXml" table.
I'm not sure your package is 'wanted', because rebuilding the cmsContentXml table is kind of a hack. In normal cases you shouldn't have to rebuild the table, although I've been in situations where it was needed because something got f****d up :P
Anyway, it's great you spent time creating the package. Rebuilding the cmsContentXml table can take up quite some time. Content editors should not be able to do something like this imo...
Rebuilding the cmsContentXml table
Hi. I've just tried to check a supposition of mine and realised that "republish entire site" doesn't refresh the cmsContentXml table. I've already had a little problem with this once when for some strange reason the content of this table went desynchronised with some document properties. Is there any mean to force refreshing of this table otherwise than complete unpublishing/publishing of documents? (what's worse is that it seems that this unpublishing/publishing should be done for every separate document).
I don't think there's an easy solution for this. I think it's best to get all the nodes of a certain type and republish them in a script or something. Here's how you can republish all media which will also update the cmsContentXml table:
You can probably do the same for content.
Jeroen
From http://our.umbraco.org/wiki/reference/api-cheatsheet/publishing-and-republishing:
Refresh the node XML
Note: This can also be achieved by calling http://YOURDOMAIN/Umbraco/dialogs/republish.aspx?xml=true and clicking "republish".
I've used the url with ?xml=true many times, it rebuilds the entire cmsContentXml table :-)
Wow. Thanks for the info. Now that's far much clearer for me. Perhaps it would be a good idea to put a checkbox to the standard "republish entire site" dialog so that to optionally include the "RePublishAll()" call into the process of republishing - to summon this dialog manually with "?xml=true" looks a bit hackish.
I've created a very simple package that replaces the "republish.aspx" dialog with one that allows to optionally turn on refreshing the "cmsContentXml" table.
http://our.umbraco.org/projects/backoffice-extensions/republishing-enhancement
I'm not sure your package is 'wanted', because rebuilding the cmsContentXml table is kind of a hack. In normal cases you shouldn't have to rebuild the table, although I've been in situations where it was needed because something got f****d up :P
Anyway, it's great you spent time creating the package. Rebuilding the cmsContentXml table can take up quite some time. Content editors should not be able to do something like this imo...
is working on a reply...