|
Member
|
sroot-accessgroup
-
6/15/2011 1:38:38 PM
Staging API
Our company has quite a few Kentico sites (all using the same database) and we want to set up a custom staging utility. We want to use staging to move changes from our test environment to production, but we don't want to automatically push all the tasks. We only want to move content and page changes, never user changes or rolls. We would like to have a form with check boxes next to the name of each site we host. When the form is submitted, the page should push all tasks of the types we want from test to production for each site that is selected, and delete all tasks that we do not want to push.
Can someone point me in the right direction for where we should start? I thought I would hop right into the staging API, but another post on these forums suggested using Bizforms, which left me confused.
For a temporary fix, is there a way to turn of the staging of certain tasks entirely, specifically creating new users or rolls?
Thanks
|
|
|
Kentico Support
|
kentico_jurajo
-
6/16/2011 1:27:22 AM
RE:Staging API
Hi, You can find the API examples for the built in content staging module in our documentation. However, you can setup the content staging to log only document changes (document content and document properties) and not to log the object changes (users, document types, page templates, etc.). then, in the UI you can select what to synchronize and where. From your description I do not see any reason of building custom staging module. What you have described is possible with the built in module too. Unless there are no other, custom needs for your staging module. Best regards, Juraj Ondrus
|
|
|
Member
|
sroot-accessgroup
-
6/16/2011 8:28:29 AM
RE:Staging API
We need to sync page templates but do not want to sync users. Also, we want to be able to sync all or a selection of sites from one page, without logging into each site individually and reading through a giant list of changes picking out the ones we actually want to promote.
I'm not sure how I can obtain the list of all pending staging tasks through the API. Once I can do that, I can filter them and have the script promote the correct tasks and delete the rest.
|
|
|
Kentico Support
|
kentico_jurajo
-
6/17/2011 2:50:36 AM
RE:Staging API
Hi,
You can still select which objects to sync. in the UI and e.g. delete the users tasks.
However, to fit your need exactly, you will have to create a custom module based on the content staging (you can take inspiration from the content staging UI source files) and use the code from the API example - the sample for selecting object is for user object, in the same way you can get the other objects (e.g. to get the page template you can use methods from CMS.PortalEngine.PageTemplateInfoProvider).
Best regards, Juraj Ondrus
|
|
|
Member
|
sroot-accessgroup
-
6/17/2011 7:48:04 AM
RE:Staging API
Thanks.
We currently have 6 sites, but we plan on adding 6-10 sites each year from here on out. Logging into each one individually to pick out all the changes that don't apply to users and rolls would be a tedious task. Hopefully we can just log into one page and select all the sites we want to promote.
|
|
|
Kentico Support
|
kentico_jurajo
-
6/17/2011 9:50:11 PM
RE:Staging API
Hi, Right now, you would need to do a little trick to share authentication cookies across domains to be authenticated for sites on different domains (but in the same CMS). In upcoming version 6.0 will be made an improvement in this regards. There are also plans for content staging improvements, but I am not sure what everything will be included in 6.0. However, as I mentioned - the source files for the staging UI are available so you can modify them according your custom needs. I do not know your projects, but do you expect so many changes in every one of the sites that it would be worthy spending now the time in the customization of the staging UI and/or creating a custom module right now? OR, another way is to use export/import feature and export only the objects you want and then import them. Best regards, Juraj Ondrus
|
|
|
Member
|
sroot-accessgroup
-
6/20/2011 7:35:55 AM
RE:Staging API
kentico_jurajo wrote: I do not know your projects, but do you expect so many changes in every one of the sites that it would be worthy spending now the time in the customization of the staging UI and/or creating a custom module right now?
The problem is that I am not making the changes, and I don't know which sites will have changes on them, so I will have to log into each site individually and check, with the possibility that I might miss one. At this point, just getting a count of all the tasks on every site would be beneficial.
|
|
|
Kentico Support
|
kentico_jurajo
-
6/22/2011 7:49:26 AM
RE:Staging API
Hi,
You can use TaskInfoProvider.GetTasks(string whereCondition, string orderBy, bool getAllData, int topN, string columns) to get the tasks which will fit your WHERE condition parameter. This will return dataset of tasks.
Then, for each task in the dataset you will run the synchronization using one of these overloads:
StagingHelper.RunSynchronization(int taskId, int serverId) - you will specify the target server ID.
RunSynchronization(int taskId, int serverId, bool runOlder, int siteId) - here you can use the site ID from the task and the server ID could be set to 0 (zero) - it means synchronization for all target servers set for this site.
Best regards, Juraj Ondrus
|
|
|
Member
|
sroot-accessgroup
-
6/22/2011 9:14:35 AM
RE:Staging API
Thank you for your assistance.
On a side note, I have noticed that, if you are subscribed to a thread, that the forums will email you to notify of you of a new post, even if it is your own post. It seems like you shouldn't get an email notification for your own posts. I'll look to see if there is another thread where I should mention this bug.
|
|
|
Kentico Consulting
|
kentico_borisp
-
6/23/2011 11:41:49 PM
RE:Staging API
Hello, This is currently the standard behavior. However, there is already a pending requirement for that. There is one workaround available, however, it is not recommended, since you are tampering with database entries: if (ForumSubscriptionInfoProvider.IsSubscribed(fsii.SubscriptionEmail, fsii.SubscriptionForumID, fsii.SubscriptionPostID)) { DataSet dsItems = ForumSubscriptionInfoProvider.GetSubscriptions(string.Format("{0}=SubscriptionPostID AND '{1}'=SubscriptionEmail", fsii.SubscriptionPostID, fsii.SubscriptionEmail), null, 1, null); if (!DataHelper.DataSourceIsEmpty(dsItems)) { DataTable temp = dsItems.Tables[0]; ForumSubscriptionInfo fsid = new ForumSubscriptionInfo(temp.Rows[0]); ForumSubscriptionInfoProvider.DeleteForumSubscriptionInfo(fsid.SubscriptionID, false); } } The problem here is the fact, that the e-mails are send out from the source code and you are not able to modify the code directly. You need to delete the subscriber from the Forums_ForumSubscription table during the creation of the new post. This is done in the file ~\CMSModules\Forums\Controls\NewPost.ascx.cs around line 858: ForumPostInfoProvider.SetForumPostInfo(fp, baseUrl, unsubscriptionUrl); Before this line you are deleting the entry from the database and after this line you are inserting it again back into the table so the user gets a notification on future posts. Best regards, Boris Pocatko
|
|
|
Member
|
sroot-accessgroup
-
6/24/2011 9:27:23 AM
RE:Staging API
I meant the forums on this site (http://devnet.kentico.com/Forums), not anything I am running.
Thanks
|
|
|
Member
|
sroot-accessgroup
-
6/24/2011 3:41:03 PM
RE:Staging API
kentico_jurajo wrote: Then, for each task in the dataset you will run the synchronization using one of these overloads:
StagingHelper.RunSynchronization(int taskId, int serverId) - you will specify the target server ID.
Thanks. Would you happen to know the method to delete a task?
|
|
|
Kentico Developer
|
kentico_helenag
-
6/25/2011 6:48:48 AM
RE:Staging API
Hello, you can get tasks for example by: CMS.Staging.TaskInfoProvider.GetTasks(string whereCondition, string orderBy, bool getAllData, int topN, string columns)
and delete them by: CMS.Staging.TaskInfoProvider.DeleteTaskInfo(int taskId)
Please see the API Reference for more details and alternative methods (the TaskInfoProvider class). Best regards, Helena Grulichova
|
|
|
Member
|
sroot-accessgroup
-
6/28/2011 3:00:12 PM
RE:Staging API
Thank you for the response, it was exactly what I was looking for. I have noticed, however, that when I use StagingHelper.RunSynchronization(taskId, si.ServerID, true, currentSiteId); the tasks are all removed from the list, even if the synchronization failed. For example, I turned off the server that the tasks are pushed to and ran my script. All of the tasks were removed from the list, but they obviously don't show on the other server. Can I get them back somehow? Is there a way to keep them from being removed from the list if the staging fails?
|
|
|
Kentico Support
|
kentico_jurajo
-
7/3/2011 2:38:09 AM
RE:Staging API
Hi,
Since you are using custom code you have to check all kind of situations like this - e.g. before running the tasks check whether the target server is running/available and if not, log an exception and do not run the tasks synchronization.
By default, the failed tasks are logged into Staging_SyncLog database table.
Best regards, Juraj Ondrus
|
|
|
Member
|
rocco.mazzeo-microgame
-
12/18/2012 9:42:21 AM
RE:Staging API
Hi all, I tried to use StagingHelper.RunSynchronization() to synchronize some tasks using a custom tool, but I receive this error: Message: WSE032: There was an error loading the microsoft.web.services3 configuration section. Stack Trace: at Microsoft.Web.Services3.Configuration.WebServicesConfiguration.get_Current() at .....
The code are: TaskInfo runTask = TaskInfoProvider.GetTaskInfo(Convert.ToInt32(task.strValue)); if (runTask != null) { // Run task string result = StagingHelper.RunSynchronization(runTask.TaskID, 61, true, runTask.TaskSiteID); if (!string.IsNullOrEmpty(result)) { output.AppendText("Task: " + runTask.TaskTitle+ " Synchronization failed: "+ result +" \n"); } else { output.AppendText("Task: " + runTask.TaskTitle+ " Synchronized \n"); } } and my app.config include a microsoft.web.services3 section: <?xml version="1.0"?> <configuration> <configSections> <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections> ... <microsoft.web.services3> <security> <securityTokenManager> <add type="CMS.Synchronization.WebServiceAuthorization" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken" /> </securityTokenManager> <x509 allowTestRoot="false" verifyTrust="false" /> </security> <policy fileName="wse3policy.config" /> </microsoft.web.services3> </configuration> Where is the problem? Thanks Rocco
|
|
|
Kentico Support
|
kentico_jurajo
-
12/19/2012 1:26:43 AM
RE:Staging API
Hello,
What is the exact version of Kentico CMS you are using? Your web.config seems to be OK. Just to be sure - could you please double check that these settings are in both, source and target server files and also please check in both BIN folders that the DLL was renamed.
Best regards, Juraj Ondrus
|
|
|
Member
|
rocco.mazzeo-microgame
-
12/19/2012 2:17:21 AM
RE:Staging API
Hi Juraj, thanks for the reply. The bin folder is ok, and the dll was renamed (Microsoft.Web.Services3.dll). The problem is related to the external wse3policy.config, I solved the problem specifying the absolute path of wse3policy.config file. My app.config now: <microsoft.web.services3> <security> <securityTokenManager> <add type="CMS.Synchronization.WebServiceAuthorization" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken"/> </securityTokenManager> <x509 allowTestRoot="true" verifyTrust="true"/> </security> <policy fileName="G:\Tool\CMSTool\wse3policy.config"/> <diagnostics> <trace enabled="false" input="InputTrace.webinfo" output="OutputTrace.webinfo"/> </diagnostics> </microsoft.web.services3> Regards Rocco
|
|
|