Migrate Umbraco data from development site to live site programmatically
I am in the situation where I have been charged with making an application or extension to Umbraco that makes the backend users able to do a migration of their changes on the development site to the live site. This migration is supposed to happen once a day, or when the backend users press a button in the backend.
I am aware that Umbraco offers this in the Courier package, but apparently it doesn't work well enough for this case.
A few more details:
The development and live site both reside on the same server and so do their databases. The data will simply need to be transferred from one folder to another and the same with the tables in the database.
As I can see there are two methods of going about this.
1) You do a full migration, where you basically do a teardown of the live database and update it to the new version. You then copy over all the files you need as well.
2) You create a package containing the document types and so on you have changed on your developer site and load that package on the live site.
The problem with number 1 is that it seems you have to republish the entire site when you have done the transfer. As far as I have understood you can do this with a webservice, but I would prefer it if I could use a console app instead.
My question is then:
Is there a way to create packages programmatically and load them in the same way or what would be the best way to achieve this migration programmatically?
Any suggestions would be much appreciated as I am kind of at a loss for a way to do this :)
EDIT
I ended up actually doing a complete mirroring in the sense that I used Robocopy to transfer all the files that had been changed in the folders, and then I did a backup of the development site with a SQL command, and then I restored it on the live database using the RESTORE SQL command.
A few settings needed to be done in the SQL commands, but it runs smoothly and a complete transfer takes down to 10 seconds depending on the number of files that have been changed.
One last thing. If you want the changes to be visible you need Umbraco to be reloaded. This you can do by modifying the web.config file, either manually or by setting it's LastWriteTime programmatically.
You can always create a usercontrol that will handle the republishing of the entire site for you, this you can call from your console app.
You could also join the Courier 2 beta program, which is indeed good enough (for features anyway, I haven't tested it myself).
Another route could be to offer all of the nodes as a xml feed and use the scheduling feature of CMSImport to migrate nodes automatically.
This is a tough one, there's a lot of options an no silver bullet yet. I have good hopes that Courier 2 will be perfect for this and am eagerly awaiting its release.
链接地址: http://www.djcxy.com/p/52260.html