summaryrefslogtreecommitdiff
path: root/rt/etc/upgrade/4.1.6/content
diff options
context:
space:
mode:
Diffstat (limited to 'rt/etc/upgrade/4.1.6/content')
-rw-r--r--rt/etc/upgrade/4.1.6/content43
1 files changed, 43 insertions, 0 deletions
diff --git a/rt/etc/upgrade/4.1.6/content b/rt/etc/upgrade/4.1.6/content
new file mode 100644
index 0000000..d27014c
--- /dev/null
+++ b/rt/etc/upgrade/4.1.6/content
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+our @Initial = (sub {
+ my $users = RT::Users->new(RT->SystemUser);
+ $users->FindAllRows;
+
+ my $attributes = $users->Join(
+ ALIAS1 => "main",
+ FIELD1 => "id",
+ TABLE2 => RT::Attributes->Table,
+ FIELD2 => "ObjectId",
+ );
+ $users->Limit(
+ ALIAS => $attributes,
+ FIELD => "ObjectType",
+ VALUE => "RT::User",
+ );
+ $users->Limit(
+ ALIAS => $attributes,
+ FIELD => "Name",
+ VALUE => RT::User::_PrefName( RT->System ),
+ );
+
+ # Iterate all users (including disabled), with config preferences set.
+ # Avoids running a query for every user in the system by only selecting
+ # those known to have preferences.
+ while (my $user = $users->Next) {
+ RT->Logger->debug(sprintf "User #%d has config preferences", $user->id);
+
+ my $config = $user->Preferences( RT->System )
+ or next;
+ next unless exists $config->{DeferTransactionLoading};
+
+ $config->{ShowHistory} = delete $config->{DeferTransactionLoading}
+ ? "click" : "delay";
+
+ $user->SetPreferences( RT->System, $config );
+ RT->Logger->debug(sprintf "Updated config Preferences for user %s (#%d)", $user->Name, $user->id);
+ }
+});
+
+1;