[Task("D2161E9B-FDF6-4F8E-8595-794B10A488F4", TaskTriggers.Hive.Revisions.PostAddOrUpdate, ContinueOnFailure = false)]
public class OnSaveAndPublish : AbstractTask
{
public OnSaveAndPublish(IFrameworkContext context) : base(context)
{
}
public override void Execute(TaskExecutionContext context)
{
var umbracoContext = Application.GetApplicationContext();
var hive = umbracoContext.Hive.Cms();
var backOfficeRequestContext = Application.GetBackOfficeRequestContext();
var hContext = HttpContext.Current;
foreach (var hostname in backOfficeRequestContext.RoutingEngine.DomainList)
{
//ToDo: Iterate and generate new sitemap depending on lang then save it to file.
Content rootContent = hive.Content.GetById(hostname.ContentId);
var siteMapBuilder = new SiteMapBuilder(hostname.Hostname, rootContent);
string path = rootContent.Name;
if(rootContent.Attributes.Contains("sitemapFilename"))
{
var sitemapFilename = rootContent.Attributes["sitemapFilename"].DynamicValue;
if(!string.IsNullOrEmpty(sitemapFilename))
{
path = sitemapFilename;
}
}
path = hContext.Server.MapPath("~/") + path + ".xml";
using (var writer = new XmlTextWriter(path, new UTF8Encoding(false)))
{
writer.Formatting = Formatting.Indented;
siteMapBuilder.SiteMap.Save(writer);
}
}
}
}
somehow this prevents the publish but i have not canceled the event ore anyting... unkown bugg in the event or someting dident go as planed.
Edit:
changed
TaskTriggers.Hive.Revisions.PostAddOrUpdate To TaskTriggers.Hive.Revisions.PostAddOrUpdateOnUnitComplete
Umbraco 5.1.0.175 (Stable Verision) Can't create anything new pages, dictionay keys ...
i have installed the stable verision 5.1.0.175 i was before on the latest nightly build but that dident work so good so i downgraded.
i have re created the database manuely and everyting worked i created my doc types, pages dictionay keys.
now everyting stoped working i can login and see everyting and update existing page content but when i try to create new stuff it won't save it.
here is one image after i created a new dictionary item
it do not show up in the tree and this is for all new stuff :(
I have tried to re create the database again like 6-9 times by hand in umbraco and it's the same first it works and later randomly this bugg shows up.
I dont know what to do now this post is my last hope.
Ok i may have found the culprit...
this
somehow this prevents the publish but i have not canceled the event ore anyting... unkown bugg in the event or someting dident go as planed.
Edit:
changed
Now it works :)
is working on a reply...