Copied to clipboard

Flag this post as spam?

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


  • Dmitriy 168 posts 588 karma points
    Apr 08, 2020 @ 11:24
    Dmitriy
    0

    Remove page history from info tab programmatically

    Hello, umbracians

    Here is the code:

    void CleanUp(IContent root)
     {
       var descendants = root.Descendants();
       var date = DateTime.Now.AddDays(1);
       foreach(var item in descendants)
       {
          ContentService.DeleteVersions(item.Id, date);
       }
    }
    

    And it cleans versions, but not a history in page Info Tab

    How to clean info tab history programmaticaly?

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Apr 08, 2020 @ 12:08
    Kevin Jump
    0

    Hi,

    I believe the code here is removing the version but not the entries from the Audit Table (which is what makes up the actions on the info tab).

    however the entries in the audit table are merely a history of events they shouldn't affect how the site performs.

    the AuditService lets you add stuff to the audit tables, but other than cleaning all the logs (based on age) via CleanLogs, I don't think you can remove speicif entries based on things like the content Id.

    AuditService.CleanLogs(60); // clean the logs of everything over an hour old
    
  • Dmitriy 168 posts 588 karma points
    Apr 09, 2020 @ 08:18
    Dmitriy
    0

    Hi, Kevin

    There is no AuditService.CleanLogs() method in Umbraco 7 :(

  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Apr 09, 2020 @ 08:22
    Kevin Jump
    100

    Yeah :(

    looks like the audit service is write only in Umbraco 7 - you will probably have to do this via SQL if you really want it cleaned out.

Please Sign in or register to post replies

Write your reply to:

Draft