Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Selective Scheduled Content Sync View modes: 
User avatar
Member
Member
thomasdb - 1/21/2014 4:24:34 AM
   
Selective Scheduled Content Sync
Has anyone had any experience with configuring the Content synchronization scheduled task to only run against a specific subset of documents? Specifically by path or document type?

I want to have items of a custom document type automatically sync to live regardless of anything else while other changes to pages and such must wait for manual synchronization and therefore approval.

Many thanks in advance.

Regards

Thomas

User avatar
Member
Member
kentico_sandroj - 1/21/2014 4:56:46 PM
   
RE:Selective Scheduled Content Sync
Hello,

In order to accomplish this you would disable the scheduled task responsible for synchronizing the content, then create a custom task that syncs only qualified objects. Leftover objects would be waiting for manual synchronization. Would this approach work for you?

Please let me know if you have any questions.

Best Regards,
Sandro

User avatar
Member
Member
thomasdb - 1/24/2014 10:33:35 AM
   
RE:Selective Scheduled Content Sync
This is a great starting point for me as I had no idea where to even begin.

I will review the documentation links you provided and see where it takes me.

Many thanks for your assistance.

Regards

Thomas

User avatar
Member
Member
thomasdb - 2/13/2014 9:17:31 AM
   
RE:Selective Scheduled Content Sync
Good Afternoon

I have go about creating a scheduled task to only sync documents with a specific path alias and it seems to work well with one exception. It appears that along with syncing the content it also sync's the pageTemplate used by that document - which is not what I want.

Would I be able to modify the following code so that it syncs only the new documents and not the templates that they use?

Many thanks in advance.

Regards
Thomas Diggins-Barnes
public string Execute(CMS.Scheduler.TaskInfo ti)
{
string result = string.Empty;
string debug = "Starting";
eventCode = "SYNCALLOBJECTS";
string CurrentInfo = "Tasks.SynchronizationCanceled";
try
{

siteId = 1;
serverId = 1;

// Get the tasks
string where = "TaskType NOT IN (N'ADDTOSITE', N'REMOVEFROMSITE') AND ((TaskNodeAliasPath LIKE '/Edition/Print/%') or (TaskNodeAliasPath = '/ARCHIVE') or (TaskNodeAliasPath LIKE '/ARCHIVE/%') or (TaskNodeAliasPath LIKE '/Opinion/%'))"; ;

int limitless = -1;
DataSet ds = CMS.Scheduler.TaskInfoProvider.ExecuteQuery("CMS.Root.SelectSyncTasks", null, where, "TaskID", limitless, "TaskID, TaskTitle", limitless, limitless, ref limitless);


result = StagingHelper.RunSynchronization(ds, 1, true, 1, AddLog);

// Log possible error
if (!string.IsNullOrEmpty(result))
{
CurrentInfo = "Editorial Sync Failed";
}
else
{
CurrentInfo = "Editorial Sync Successful";
}

}
catch (ThreadAbortException ex)
{
string state = ValidationHelper.GetString(ex.ExceptionState, string.Empty);
if (state == CMSThread.ABORT_REASON_STOP)
{
CurrentInfo = "Tasks.CanceledSync";
}
else
{
CurrentInfo = "Editorial Sync Failed";
}
}
catch (Exception ex)
{
CurrentInfo = "Editorial Sync Failed" + ": " + ex.Message;
}
finally
{
// Finalize log context
//FinalizeContext();
}
return CurrentInfo;
}

User avatar
Member
Member
kentico_sandroj - 2/14/2014 11:59:54 AM
   
RE:Selective Scheduled Content Sync
Hi Thomas,

The standard approach for accomplishing something like this is using the LogChange handler. You would simply disable the logging for the template task. Otherwise you would likely use the template class name to exclude it from your where condition in the current approach; however, I would recommend using the Logchange handler instead. Would that work for you?

Best Regards,
Sandro

User avatar
Member
Member
thomasdb - 2/17/2014 3:34:15 AM
   
RE:Selective Scheduled Content Sync
Sandro

Thank you for your reply. I understand the approach of using the LogChange handler and it makes sense however I do not think that it would help.

I suspect that I did not explain my issue correctly but what I am seeing is that Kentico "appears" to be syncing items that have not been changed.

Here is an example of what I am seeing:

I add several new folders and a custom document into the system under the hierarchy: Archive/2014/02/17/New Article

The custom document uses a specific page template "DIGITALARTICLE" which is used but not changed

Looking in the sync task list I have rows for the creation of the folders and the custom document and an update task for the page template made prior to the creation of the new items.

The scheduled task runs and syncs the items that I created (matching my where clause) removing them from the task list. The update for the page template still remains.

The live site is updated as expected with the new items but also the changes made to the document template have been synced also.

I can tell that the document template has been updated in the live system as its version number has been incremented and the date/time of this update matches the time that the sync occurred but there is nothing in the logs to say that it was changed.

Is there something in my code that adds a loophole for this described behavior or does the system include dependencies that force it to sync page templates? As the task remains in the staging site list awaiting a manual sync I would not think this the case but it has me puzzled.

Regards

Thomas

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/28/2014 5:21:39 AM
   
RE:Selective Scheduled Content Sync
Hi,

Have you tried using this web.config key?

<add key="CMSSynchronizeSharedTemplatesWithDocuments" value="false" />


It indicates if changes made to page templates used by multiple documents should be synchronized together with document update synchronization tasks of all documents using the template. If disabled, document update tasks will not include page template synchronization tasks.

I hope it will help.

Best regards,
Juraj Ondrus