I have two environments A and B. I'm trying to write a script that is triggered by our continious integration servers that will uSync all content from B into A.
So far my script copys everything in B's uSync\content folder to A's uSync\content folder but I have to manually log into A and click "import" in uSync to have it import all the content.
Is there a way I could automate this? Even if there is a url I could have my script send a request to that would work.
there isn't a built in remote command, but you could write an api controller that calls ImportDiskContent on the ContentImporter Class, then uSync would kick off a fill import of what is on the disk, then you could just call the URL of the APIController and that would be able to start the import ?
probibly along the lines of (and i am typing this here, so this is just psudo code).
public SomeApiContoller : UmbracoAPIController
{
public bool DoUsyncImport()
{
var usync = new jumoo.usync.content.ContentImporter();
uSync.ImportDiskContent();
}
}
but that just means it's three calls in the controller.
ContentImporter ci = new ContentImporter();
int contentCount = ci.ImportDiskContent();
MediaImporter mi = new MediaImporter();
int mediaCount = mi.ImportMedia();
// we map ids at the end..
ci.MapContentIds();
Automate Import
I have two environments A and B. I'm trying to write a script that is triggered by our continious integration servers that will uSync all content from B into A.
So far my script copys everything in B's uSync\content folder to A's uSync\content folder but I have to manually log into A and click "import" in uSync to have it import all the content.
Is there a way I could automate this? Even if there is a url I could have my script send a request to that would work.
Hi,
there isn't a built in remote command, but you could write an api controller that calls ImportDiskContent on the ContentImporter Class, then uSync would kick off a fill import of what is on the disk, then you could just call the URL of the APIController and that would be able to start the import ?
probibly along the lines of (and i am typing this here, so this is just psudo code).
then
http://site/umbraco/api/SomeApi/DoUsyncImport - would kick pff the import (i think)
HI just realised it's slightly more involved, you also need to import media, and then map id's - it's actually the code in the ui class that is behind the import button. (here https://github.com/KevinJump/jumoo.usync/blob/master/jumoo.usync.usyncui/uSyncTab.ascx.cs)
but that just means it's three calls in the controller.
I have to say this is brilliant! being able to sync two environments on demand with three calls...
is working on a reply...