[Rt-commit] rt branch 5.0/skip-additional-initialdata-serialization created. rt-5.0.5-120-gd66b0b70b8

BPS Git Server git at git.bestpractical.com
Sun Jan 21 15:40:14 UTC 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/skip-additional-initialdata-serialization has been created
        at  d66b0b70b84bc14a59f0fea4452127a2005fe7a5 (commit)

- Log -----------------------------------------------------------------
commit d66b0b70b84bc14a59f0fea4452127a2005fe7a5
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Sun Jan 21 10:39:32 2024 -0500

    Skip additional attributes when serializing JSON
    
    Even when the --no-users option is provided to rt-dump-initialdata, RT
    can still serialize users required to maintain internal consistency of
    data. These additional options to rt-dump-initialdata can help to
    minimize the amount of data produced for these users:
    
        --no-dashboards
        --no-subscriptions
        --no-bookmarks

diff --git a/lib/RT/Migrate/Serializer.pm b/lib/RT/Migrate/Serializer.pm
index 1c6b8e16b0..ea86f5f8e6 100644
--- a/lib/RT/Migrate/Serializer.pm
+++ b/lib/RT/Migrate/Serializer.pm
@@ -73,6 +73,9 @@ sub Init {
         FollowTransactions  => 1,
         FollowACL           => 0,
         FollowAssets        => 1,
+        FollowDashboards    => 1,
+        FollowSubscriptions => 1,
+        FollowBookmarks     => 1,
 
         Clone       => 0,
         Incremental => 0,
@@ -95,6 +98,9 @@ sub Init {
                   FollowTransactions
                   FollowAssets
                   FollowACL
+                  FollowDashboards
+                  FollowSubscriptions
+                  FollowBookmarks
                   Queues
                   CustomFields
                   HyperlinkUnmigrated
diff --git a/lib/RT/Migrate/Serializer/JSON.pm b/lib/RT/Migrate/Serializer/JSON.pm
index 279671183f..e1b4059f92 100644
--- a/lib/RT/Migrate/Serializer/JSON.pm
+++ b/lib/RT/Migrate/Serializer/JSON.pm
@@ -363,6 +363,7 @@ sub CanonicalizeUsers {
         }
 
         $user->{Privileged} = $object->Privileged ? JSON::true : JSON::false;
+        #$user->{Privileged} = $object->Privileged ? \1 : \0;
     }
 }
 
@@ -605,6 +606,13 @@ sub CanonicalizeAttributes {
         delete $self->{Records}{'RT::Attribute'}{$key}
           if $self->{Records}{'RT::Attribute'}{$key}{Name} =~
           /^(?:UpgradeHistory|QueueCacheNeedsUpdate|CatalogCacheNeedsUpdate|CustomRoleCacheNeedsUpdate|RecentlyViewedTickets)$/;
+
+        delete $self->{Records}{'RT::Attribute'}{$key}
+          if $self->{Records}{'RT::Attribute'}{$key}{Name} =~ 'Dashboard' && !$self->{FollowDashboards};
+        delete $self->{Records}{'RT::Attribute'}{$key}
+          if $self->{Records}{'RT::Attribute'}{$key}{Name} eq 'Bookmarks' && !$self->{FollowBookmarks};
+        delete $self->{Records}{'RT::Attribute'}{$key}
+          if $self->{Records}{'RT::Attribute'}{$key}{Name} eq 'Subscription' && !$self->{FollowSubscriptions};
     }
 }
 
diff --git a/sbin/rt-dump-initialdata.in b/sbin/rt-dump-initialdata.in
index 57f3a57eaf..fefacb7c67 100644
--- a/sbin/rt-dump-initialdata.in
+++ b/sbin/rt-dump-initialdata.in
@@ -102,6 +102,9 @@ GetOptions(
     "deleted!",
     "disabled!",
 
+    "dashboards!",
+    "subscriptions!",
+    "bookmarks!",
     "scrips!",
     "acls!",
     "assets!",
@@ -131,6 +134,10 @@ $args{FollowDisabled} = $OPT{disabled} if defined $OPT{disabled};
 $args{FollowScrips}  = $OPT{scrips}   if defined $OPT{scrips};
 $args{FollowACL}     = $OPT{acls}     if defined $OPT{acls};
 
+$args{FollowDashboards}    = $OPT{dashboards}    if defined $OPT{dashboards};
+$args{FollowSubscriptions} = $OPT{subscriptions} if defined $OPT{subscriptions};
+$args{FollowBookmarks}     = $OPT{bookmarks}     if defined $OPT{bookmarks};
+
 $args{FollowAssets} = $OPT{assets} if defined $OPT{assets};
 
 $args{Sync} = 1 if $OPT{sync} || $OPT{base};

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list