Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jay 425 posts 652 karma points
    Apr 19, 2024 @ 14:32
    Jay
    0

    Is there a way to disable Save and Publishing history event?

    I've got a node that is on a scheduled publishing event using the Content Service's SaveAndPublish which triggers every hour.

    Due to that the history of that node will grow over time.

    Was wondering if there's a way to ask it ignore adding to the history for that node?

    We used to have a boolean value in the old umbraco for raiseEvents which you can set to false to do that

    Thanks

  • Yakov Lebski 590 posts 2344 karma points
    Apr 19, 2024 @ 14:47
    Yakov Lebski
    0

    depend on umbraco version, umbraco has history cleanup process, you can define it more frequent for specific document type Document Type->Permission->History cleanup

    raiseEvents aslo avaliable - not sure that it will do that you need

    using (var scope = StateService.ScopeProvider.CreateScope(autoComplete: true))
    {
        using (_ = scope.Notifications.Suppress())
        {
            ContentService.SaveAndPublish(item);
        }
    }
    
  • Jay 425 posts 652 karma points
    Apr 19, 2024 @ 17:41
    Jay
    0

    I've tried this code in Umbraco 13, it still keeps adding to the history not sure why

  • Yakov Lebski 590 posts 2344 karma points
    Apr 20, 2024 @ 17:15
    Yakov Lebski
    0

    Yes, it should. it also will create a new version of document. I think cleanup it easy way to solve it

  • Jay 425 posts 652 karma points
    Apr 25, 2024 @ 21:39
    Jay
    0

    When you say cleanup, how do you do that?

    Thanks

  • Yakov Lebski 590 posts 2344 karma points
    Apr 26, 2024 @ 03:18
  • Jay 425 posts 652 karma points
    Apr 29, 2024 @ 11:18
    Jay
    0

    This works like a charm.

    But the naming is so confusing trying to figure out what each one does

    Like the KeepLatestVersionPerDayForDays

    and the

    KeepAllVersionsNewerThanDays




    So a brief of what I've understand so far is

    KeepLatestVersionPerDayForDays - This one keeps only 1 version for a particular content node (which is the latest version - aka last saved version) for x numbers of days. So if you set this to like 180 days. It will keep only the latest version of a content node on each day.

    KeepAllVersionsNewerThanDays - This one sets how many days you want to keep the full version of your content nodes. Eg if you set it to 4 and your homepage have been saved and published like 10 times for today (that's the total number of version for that day - a total of 10 versions) and it will keep all of that full versions and the rest of the full versions of the other 4 days too.

Please Sign in or register to post replies

Write your reply to:

Draft