Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jun 03, 2014 @ 00:08
    Nicholas Westby
    0

    uSync is Deleting Content?

    Umbraco 7.0.4. uSync 2.0.0(RC4).

    Not really sure if it's uSync causing this, but it seems likely to me. I and another developer are working on building an Umbraco website using our individual computers, though connected to the same SQL Server database. Every now and then, I'll add a new property (actually, the most recent time this happened I renamed an existing property) to a document type, then I'll publish some nodes with values set for those properties, and later I'll visit those nodes and the data on those properties will be empty (i.e., it vanished).

    Note that I am looking at the properties in the Umbraco backend, which should be grabbing the latest data from the database, so I don't imagine this is an issue with the umbraco.config XML cache being out of date. Also, two other developers (off and on the same project I'm working on) have noticed this too, so it's a fairly common occurrence.

    My guess is that maybe uSync on the other developer's computer thinks it's got the most recent definition of the document types and deletes the property (deleting the content associated with the property in the process), but then my uSync sees that it has the newest definition and restores the property.

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Jun 03, 2014 @ 14:01
    Kevin Jump
    0

    Hi Nicholas,

    Yeah i don't think usync should be doing that! - from memory (and v7.0.4 wasn't the greatest version for usync because of some things in the core api). usync will take out properties it doesn't see in it's xml file so if one developer has a file without a property then it's going to get removed every-time they run the site up.

    I would reset everyone's usync folders, best way to do that is

    • pick a source site,
    • delete the usync folder
    • restart the site (the usync folder will get re-created)
    • replace the usync folder on all other develper pcs with that one
    • fire up their sites.

    but in your post you've said you have a shared DB, and with a shared DB you don't actually need usync - usync was written so you could work remotely with diffrent DBs - because all it does is take the things that are in the DB and write them to disk, if you are sharing the DB then the usync bit isn't needed.

    if you are using usync to get from dev to live you can change the settings (in config/usyncsettings.config) so it only writes out the changes from any dev site (just set read=false). then your development environment will still have a usync folder but it won't be doing anything between your development machines (which doesn't matter because you have a shared db). on your live site you set it to read=true an when you deploy up it will copy the changes but only on live.

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jun 03, 2014 @ 18:00
    Nicholas Westby
    0

    Thanks for the quick response!

    What does setting read=false actually do (I noticed there is also a "write" attribute and I'm not sure what the difference is between each of those)? It's hard to know, as the documentation is a little sparse. By the way, I noticed this setting:

    <DocumentTypes DeletePropertyValues="true" />
    

    Perhaps setting that to false would prevent the properties from being deleted?

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Jun 03, 2014 @ 18:11
    Kevin Jump
    0

    yeah sorry - documentation never a developers strong point.

    read = true/false - usync will read the files from the disk (and put them in the db) at startup write = true/false - usync will write to the disk (from the db) at startup attach = true/false - usync attaches to all the save events and when something saves it writes it out

    if the usync folder is missing a write is performed at start up - so in general people have read=true, write=fasle, attach=true - but if you don't need to always take the updates read=false will make it simpler.

    DeletePropertValues is a hang over from an older version - where the delete was something i was testing, and didn't want it to delete all your values for no reason - wthe version for umbraco 7 has that whole section of code re-written to use hte new api and 'i think' that setting doesn't work... but i will go check the code. as i said the v7.0.4 version was a bit of a difficult thing because of other api issues.

  • Kevin Jump 2309 posts 14673 karma points MVP 7x c-trib
    Jun 03, 2014 @ 18:14
    Kevin Jump
    0

    Hi just checked the code https://github.com/KevinJump/jumps.umbraco.usync/blob/v2.0rc-Umbraco-7.0.x/jumps.umbraco.usync/SyncProviders/ContentTypeSyncProvider.cs#L191

    and the delete setting does indeed stop it from deleting the properties - and i wrote it!

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jun 03, 2014 @ 18:30
    Nicholas Westby
    0

    Thanks for the quick overview!

    And I was just looking at the code myself. Looks like the latest version also respects that configuration value: https://github.com/KevinJump/jumps.umbraco.usync/blob/v2.2-Umbraco-7/jumps.umbraco.usync/Extensions/IContentTypeExtensions.cs#L160-L166

    I will go ahead and set read=false and DeletePropertyValues=false. When we are ready to deploy to staging/production, I will modify those values.

    Thank again for the help and quick responses.

Please Sign in or register to post replies

Write your reply to:

Draft