[Rt-commit] r15710 - in rt/3.8/trunk: etc/upgrade/3.8.2

sartak at bestpractical.com sartak at bestpractical.com
Tue Sep 2 22:33:03 EDT 2008


Author: sartak
Date: Tue Sep  2 22:33:00 2008
New Revision: 15710

Added:
   rt/3.8/trunk/etc/upgrade/3.8.2/
   rt/3.8/trunk/etc/upgrade/3.8.2/content
Modified:
   rt/3.8/trunk/   (props changed)

Log:
 r70892 at onn:  sartak | 2008-09-02 22:32:30 -0400
 First stab at a dashboard upgrade script (wanted to commit it before I svk up'd to test :))


Added: rt/3.8/trunk/etc/upgrade/3.8.2/content
==============================================================================
--- (empty file)
+++ rt/3.8/trunk/etc/upgrade/3.8.2/content	Tue Sep  2 22:33:00 2008
@@ -0,0 +1,36 @@
+ at Final = (
+    sub {
+        $RT::Logger->debug("Going to adjust dashboards");
+        my $sys = RT::System->new($RT::SystemUser);
+
+        my $attrs = RT::Attributes->new( $RT::SystemUser );
+        $attrs->Named('Dashboard');
+
+        if ($attrs->Count == 0) {
+            $RT::Logger->debug("You have no dashboards. Skipped.");
+            return 1;
+        }
+
+        while (my $attr = $attrs->Next) {
+            my $props = $attr->Content;
+            if (exists $props->{Searches}) {
+                $props->{Portlets} = [ map {
+                    my ($privacy, $id, $desc) = @$_;
+
+                    {
+                        portlet_type => 'search',
+                        privacy      => $privacy,
+                        id           => $id,
+                        description  => $desc,
+
+                    }
+                } @{ delete $props->{Searches} } ];
+            }
+            my ($status, $msg) = $attr->SetContent( $props );
+            $RT::Logger->error($msg) unless $status;
+        }
+
+        $RT::Logger->debug("Fixed.");
+        return 1;
+    },
+);


More information about the Rt-commit mailing list