Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a question around the Config for Sync Source.
In the config settings you have the Sync Source setting where it saves any changes to disk. Can you tell me is this change is when you Save or when you Save and Publish?
If it is only when you Save, is there any way to modify the code so that it only writes to the disk when you Save and Publish?
The default is when you save (so also save and publish) - mainly because uSync deals with a lot of things that don't have the concept of publish so only save.
but you could extend it with your own code to be only publish (for content). first you would want to turn of save events.
so if you register for umbraco's publish event :
Umbraco.Core.Services.ContentService.Published += ContentService_Published;
you can then work through any items that are published, get the XML from uSync and save it how you wish.
private void ContentService_Published(Umbraco.Core.Publishing.IPublishingStrategy sender, Umbraco.Core.Events.PublishEventArgs<Umbraco.Core.Models.IContent> e)
foreach (var item in e.PublishedEntities)
var attempt = uSyncCoreContext.Instance.ContentSerializer.Serialize(item);
// at this point the attempt.item value is an XElement
// so you can save it somethere
// uSync builds a path based on parents, but if doesn't
// have to be that it can be anything
uSync has a GetContentPath function which builds a path based on the node names, but it can be anything.
and if you did save this into the uSync/Content then a importing usync at the other end would import the content (which is i suspect what you want to do ?)
the actual folder names in the don't matter when it comes to importing all the data comes from the files.
the only thing to note about the folder structure if you are importing is that there there something to ensure the parent nodes are higher then their child nodes so they get imported first.
Also worth noting if you don't want to turn the export of for everything then it can be done on a per handler basis - see the docs for some info.
but without turning off the main ExportOnSave setting you could just turn off saves of content with
<HandlerConfig Name="uSync: ContentHandler" Enabled="false"/>
which will just stop the built-in content handler from doing anything on that instance of the site. while everything else would still export on save.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted