KevinJump / uSync-Legacy

uSync for Umbraco 4/6 - bits of the database to disk, and stuff like that
https://jumoo.co.uk/usync/
Mozilla Public License 2.0
75 stars 63 forks source link

Filter while Exporting (enhancement request) #193

Open JohnBergman opened 5 years ago

JohnBergman commented 5 years ago

We have a site that has a lot of user submitted content (user created blogs for example); so it has a forward facing front end allowing CMS documents to be created and added.

We would like to have a staging site where in-house content and enhancements are created and managed, the difficulty here is syncing between the two environments does not currently seem very doable.

Therefore: What we are thinking is if we could have a set of hooks that would allow us to make a determination as to whether it should be exported (on demand most likely) - we could export the user generated content from the live site, and pull it into the staging site; and conversely export the in-house created content, configuration, etc and import it into the live site.

If you have other suggestions, I'd love to hear them -

KevinJump commented 5 years ago

Hi

Yeah there are a few existing things (that might not fit - but be close) to what you want already floating around inside uSync.

Content / Media Path

so for content and media you can add a setting to selectively import based on the path (or ignore). so for example :

    <HandlerConfig Name="uSync: ContentHandler" Enabled="true">
      <Setting Key="include" Value="homepage\example" />
    </HandlerConfig>

    <HandlerConfig Name="uSync: MediaHandler" Enabled="true">
      <Setting Key="include" Value="sample-media" />
    </HandlerConfig>

this only imports content in the path "homepage/example" and only imports media from "sample-media" folder

the path names are made up from the name of the content/media

there is also an ignore value that does similar things the other way around :

      <Setting Key="ignore" Value="homepage\imported" />

ignores everything in the homepage/imported path.

Events

there are events when uSync is saving stuff to disk (so you can control the output). You should beable to trigger on

uSyncEvents.SavingFile 
uSyncEvents.SavedFile 

but these will just give you the files that uSync is saving you would have to go into the xml to potentially workout if you wanted them.

Extra Dev

We can add extra events and intergration points if you think that will help, but you could also look at calling the handlers yourself. the Content Handler (which does all the export/importing of content) can be called to export a folder, given a content id, and it will put the files where ever you want, ready for import onto another site.

JohnBergman commented 5 years ago

Seems like changing handlerconfig (or maybe adding a new one) that would allow me to exclude/include by document type alias might be a good addition.

I'll dig around and look at savingfile, if I can simply not save things, that might be enough. Thanks for the pointers :-)