var uSyncBackOffice = uSyncBackOfficeContext.Instance;
var actions = uSyncBackOffice.ImportAll()
Then actions will be IEnumberable of uSyncAction if you want to check it all worked or not...
ImportAll also takes a couple of optional params, so you can even run it from another folder, or force a full import (one where everything is imported even if it hasn't changed) if you want
the basic usync code isn't saving versions, but if you have a set of files for each stage, you can just pass the relevant folders into the ImportAll() call, so you might have folders called /step1 /step2 etc...
you can just call ImportAll("~/mystuff/step1")
then Importall("~mystuff/step2") so it would do two or how ever many imports... you wanted to do.
uSync.Snapshots, will let you make snapshot folders, so you could use that to make a snapshots folder for each stage (they will only contain the changes between each snapshot)
you could then import these as part of a migration either by calling ImportAll for the right folders or if you use usync. snapshots then you could call something similar to this to apply only one snapshot
var root = IOHelper.MapPath("~/uSync/Snapshots");
SnapshotManager snapshotManager = new SnapshotManager(root);
return snapshotManager.Apply(snapshotName);
Having said all of that, uSync and uSync Content Edition may do what you want in one go.
If you move your properties to the parent, then umbraco will delete the content when that happens, but if you also import the content files with contentEdition it 'should' put all the content back*
so a usync import with the doctype changes in it and the content files (produced by content edition) would do both?
*you might have to do a forced import, because content changes are tracked by save date
It's a pretty large project with a lot of content so I prefer to do things manually instead of using uSync Content Edition. I'll try the different folder approach.
How can I change the folder name? I assume I need to change the folder name. Than do step 1 and 2. Than change the folder name again for step 4?
Might be easier to manually write the uSync file for deletion since I can't delete it yet.
yeah from what you're saying i would be inclined to do bits of it by hand.
Just take the relevant files from the doctype folder and cut/ paste the properties elements. then on sync the properties will be deleted / moved.
if you used snapshots on the source site, you could just create a new snapshot between each step and then you would have different folders for each change (in the usync/snapshots folder).
Manually execute uSync import
Hello,
I'm using the Umbraco migrations (https://cultiv.nl/blog/using-umbraco-migrations-to-deploy-changes/) and I would like to make sure that uSync has run before the migration.
Currently both uSync and the migrations are executed in the ApplicationStarted event. So it's not clear which code will run first.
In a migration it's possible to also execute code. So in there I could run the uSync import code. Can I just run uSyncBackOffice.ImportAll()?
Jeroen
hi
yes, you can just call the back office.
Then
actions
will be IEnumberable of uSyncAction if you want to check it all worked or not...ImportAll also takes a couple of optional params, so you can even run it from another folder, or force a full import (one where everything is imported even if it hasn't changed) if you want
I tried this and it seems to have worked but for some reason, Usync didn't create a new log-entry. Does it not do this when you call the API manually?
Thanks Kevin.
Do you keep versions when running an import?
If first would like to run a uSync import, than do my own code migration and than do another import.
Maybe it's easier to explain what I'm trying to do ;-).
I have some properties on a child doctype and I need to move it to a parent doctype and keep existing content. So this is my idea:
For our CI I need to execute step 1 to 4 in that order. Any suggestions?
Jeroen
Hi,
the basic usync code isn't saving versions, but if you have a set of files for each stage, you can just pass the relevant folders into the ImportAll() call, so you might have folders called /step1 /step2 etc...
you can just call
ImportAll("~/mystuff/step1")
thenImportall("~mystuff/step2")
so it would do two or how ever many imports... you wanted to do.uSync.Snapshots, will let you make snapshot folders, so you could use that to make a snapshots folder for each stage (they will only contain the changes between each snapshot)
you could then import these as part of a migration either by calling ImportAll for the right folders or if you use usync. snapshots then you could call something similar to this to apply only one snapshot
Having said all of that, uSync and uSync Content Edition may do what you want in one go.
If you move your properties to the parent, then umbraco will delete the content when that happens, but if you also import the content files with contentEdition it 'should' put all the content back*
so a usync import with the doctype changes in it and the content files (produced by content edition) would do both?
*you might have to do a forced import, because content changes are tracked by save date
Thanks for your suggestions.
It's a pretty large project with a lot of content so I prefer to do things manually instead of using uSync Content Edition. I'll try the different folder approach.
How can I change the folder name? I assume I need to change the folder name. Than do step 1 and 2. Than change the folder name again for step 4?
Might be easier to manually write the uSync file for deletion since I can't delete it yet.
Jeroen
yeah from what you're saying i would be inclined to do bits of it by hand.
Just take the relevant files from the doctype folder and cut/ paste the properties elements. then on sync the properties will be deleted / moved.
if you used snapshots on the source site, you could just create a new snapshot between each step and then you would have different folders for each change (in the usync/snapshots folder).
is working on a reply...