[Rt-commit] [rtir] 02/08: Upgrade script to change summary to sidebar for existing RTIR DBs

Kevin Falcone falcone at bestpractical.com
Fri Mar 28 17:06:04 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch master
in repository rtir.

commit 3fb4be62c57ac971d4625ca57fe29bba25bf5027
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