diff options
author | Ivan Kohler <ivan@freeside.biz> | 2015-07-09 22:18:55 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2015-07-09 22:27:04 -0700 |
commit | e131b1f71f08b69abb832c1687d1f29682d171f8 (patch) | |
tree | 490167e41d9fe05b760e7b21a96ee35a86f8edda /rt/etc/upgrade/4.1.6 | |
parent | d05d7346bb2387fd9d0354923d577275c5c7f019 (diff) |
RT 4.2.11, ticket#13852
Diffstat (limited to 'rt/etc/upgrade/4.1.6')
-rw-r--r-- | rt/etc/upgrade/4.1.6/content | 43 |
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 000000000..d27014c94 --- /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; |