NOT updating roles or users when synchronising websites

Olivier Cozette asked on February 17, 2015 21:35

Is there an easy way NOT to synchronize roles between DEV and PROD servers ? Let's say I want to log synchronization tasks for all objects EXCEPT roles and users.

Of course I can unselect from my task's list, all tasks refered to users and roles, but I just don't want them to be loged. Is it possible ?

Correct Answer

Brenden Kehren answered on February 19, 2015 13:48

Out of the box, no. If you choose to log object, content, etc. changes, it does all of them. The only time it won't is if you write code around it.

There are a few things you could look at though. One would be to create a scheduled task that would look at all the changes that have been logged every XX hours and if that object is of type xxxx.xxxxx then remove it. I'd suggest creating a custom setting that has a semi-colon separated list of class names so you can easily add/remove items from it.

Another thing would be to capture the events BEFORE they write to the database with a global handler and during the update/insert, wrap the statement in a using statement like so:

using (new CMSActionContext { LogSynchronization = false })
{
  // do your work here
}

I haven't tested this method but there is a chance you may already be too late.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Olivier Cozette answered on February 19, 2015 16:09

Thanks a lot Brenden, I will try your idea using the sched task !

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.