Can someone please assist with our issue:
When we unselect "Include Media" on a push/pull from a site, the media URL still gets changed as seen in the picture. Is there anyway to ensure the media URL is not updated on a push/pull?
We are using Usync V8.10.7, Usync.Complete V8.11.7
"Include Media" means include the media files, that doesn't apply to not including the media properties
there are instances where the media may well already be there / synced another way - and updating the properties is required, so this behavior is 'expected' by many.
You could override the handler/Serializer (sample code below). But by design the content handlers/serizliers in uSync don't know if you have selected "include media" in the uSync.Publisher dialog, (they don't even know what publisher is).
So, there isn't an easy way to communicate that between the two bits of code.
If you want to straightforwardly say, Never include these items in the serizlation then the override code will do that (in v8 - as this can be done by config in v10+)
this could be configured for dev/stage so they never send media to the other server as required but it's probably not possible to do it based on the option being picked in the UI.
Example Content Handler /Serializer (note this has not been tested!)
public class CustomPropertyContentHandler : ContentHandler
{
public CustomPropertyContentHandler(
IContentService contentService,
IEntityService entityService,
IProfilingLogger logger,
AppCaches appCaches,
CustomPropertyContentSerializer serializer, // this is the changed line.
ISyncItemFactory syncItemFactory,
SyncFileService syncFileService)
: base(contentService, entityService, logger, appCaches, serializer, syncItemFactory, syncFileService)
{
}
protected CustomPropertyContentHandler(
IEntityService entityService,
IProfilingLogger logger,
IContentService contentService,
CustomPropertyContentSerializer serializer, // this is the changed line
ISyncTracker<IContent> tracker,
AppCaches appCaches,
ISyncDependencyChecker<IContent> checker,
SyncFileService syncFileService)
: base(entityService, logger, contentService, serializer, tracker, appCaches, checker, syncFileService)
{
}
}
public class CustomPropertyContentSerializer : ContentSerializer
{
public CustomPropertyContentSerializer(
IEntityService entityService,
ILocalizationService localizationService,
IRelationService relationService,
ILogger logger,
IContentService contentService,
IFileService fileService,
SyncValueMapperCollection syncMappers)
: base(entityService, localizationService, relationService, logger, contentService, fileService, syncMappers)
{
this.dontSerialize = new string[]
{
"listOfProperties", "thatYouDont", "wantToBeSerialized", "byAlias"
};
}
protected override XElement SerializeProperties(IContent item, SyncSerializerOptions options)
{
// you could also override the property serialization
// at this point you have the content item, you could
// in theory work out if the properties are media properties
// (this might be slow)
// but at this point the ContentSerializer does not know if you
// have selected 'Include media' in uSync.Complete as that is
// a diffrent process/project.
return base.SerializeProperties(item, options);
}
}
How to stop overriding media URL when include media is turned off when doing a push/pull from other environments
Can someone please assist with our issue: When we unselect "Include Media" on a push/pull from a site, the media URL still gets changed as seen in the picture. Is there anyway to ensure the media URL is not updated on a push/pull?
We are using Usync V8.10.7, Usync.Complete V8.11.7
Hi,
"Include Media" means include the media files, that doesn't apply to not including the media properties
there are instances where the media may well already be there / synced another way - and updating the properties is required, so this behavior is 'expected' by many.
You could override the handler/Serializer (sample code below). But by design the content handlers/serizliers in uSync don't know if you have selected "include media" in the uSync.Publisher dialog, (they don't even know what publisher is).
So, there isn't an easy way to communicate that between the two bits of code.
If you want to straightforwardly say, Never include these items in the serizlation then the override code will do that (in v8 - as this can be done by config in v10+)
this could be configured for dev/stage so they never send media to the other server as required but it's probably not possible to do it based on the option being picked in the UI.
Example Content Handler /Serializer (note this has not been tested!)
Thank you Kevin for the reply. We will try the proposed solution.
is working on a reply...