[Rt-commit] [rtir] 02/07: Upgrade script to change summary to sidebar for existing RTIR DBs
Jim Brandt
jbrandt at bestpractical.com
Wed Mar 26 16:21:44 EDT 2014
This is an automated email from the git hooks/post-receive script.
jbrandt pushed a commit to branch 3.2/rtir-homepage-updates
in repository rtir.
commit 5f39152a8b576ba85555d309aaaeea9eae0b0351
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Wed Mar 26 16:18:05 2014 -0400
Upgrade script to change summary to sidebar for existing RTIR DBs
---
etc/upgrade/3.1.0/content | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/etc/upgrade/3.1.0/content b/etc/upgrade/3.1.0/content
new file mode 100644
index 0000000..83b1bfc
--- /dev/null
+++ b/etc/upgrade/3.1.0/content
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+our @Initial = (
+ sub {
+ my $users = RT::Users->new(RT->SystemUser);
+ my $attributes = $users->Join(
+ ALIAS1 => "main",
+ FIELD1 => "id",
+ TABLE2 => "Attributes",
+ FIELD2 => "ObjectId",
+ );
+ $users->Limit(
+ ALIAS => $attributes,
+ FIELD => "ObjectType",
+ VALUE => "RT::User",
+ );
+ $users->Limit(
+ ALIAS => $attributes,
+ FIELD => "Name",
+ VALUE => RT::User::_PrefName('RTIR_HomepageSettings'),
+ );
+
+ while (my $user = $users->Next) {
+ my $settings = $user->Preferences('RTIR_HomepageSettings')
+ or next;
+ next if exists $settings->{sidebar};
+
+ $settings->{sidebar} = delete $settings->{summary};
+ $user->SetPreferences('RTIR_HomepageSettings', $settings);
+ }
+ },
+ sub {
+ my ($default_portlets) = RT->System->Attributes->Named('RTIR_HomepageSettings');
+ my $settings = $default_portlets->Content;
+ return if exists $settings->{sidebar};
+
+ $settings->{sidebar} = delete $settings->{summary};
+ $default_portlets->SetContent($settings);
+ },
+);
+
+
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list