[Rt-commit] rt branch, 4.2/dashboard-tables, updated. rt-4.0.0rc6-174-g8f7badd
Shawn Moore
sartak at bestpractical.com
Mon Mar 21 10:26:46 EDT 2011
The branch, 4.2/dashboard-tables has been updated
via 8f7baddf7c4e6ad028a73f9fd034f15338bdbaaa (commit)
from 01896a802cd43dc3106b47477cf68f7dbc110c4b (commit)
Summary of changes:
etc/upgrade/4.1.1/content | 52 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
create mode 100644 etc/upgrade/4.1.1/content
- Log -----------------------------------------------------------------
commit 8f7baddf7c4e6ad028a73f9fd034f15338bdbaaa
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Mon Mar 21 10:26:20 2011 -0400
Upgrade script for attributes into dashboards
Still need to handle subscriptions
diff --git a/etc/upgrade/4.1.1/content b/etc/upgrade/4.1.1/content
new file mode 100644
index 0000000..15586e5
--- /dev/null
+++ b/etc/upgrade/4.1.1/content
@@ -0,0 +1,52 @@
+my $convert_attributes = sub {
+ my $obj = shift;
+
+ for my $attribute ($obj->Attributes->Named('Dashboard')) {
+ my $dashboard = RT::Dashboard->new($RT::SystemUser);
+
+ my ($ok, $msg) = $dashboard->Create(
+ Name => $attr->Description,
+ Content => $attr->Content,
+ ObjectType => ref($obj),
+ ObjectId => $obj->id,
+ );
+
+ if (!$ok) {
+ $RT::Logger->error("Unable to reify attribute " . $attr->id . " into a dashboard: $msg");
+ next;
+ }
+
+ ($ok, $msg) = $attr->Delete;
+
+ if (!$ok) {
+ $RT::Logger->error("Reified attribute into dashboard " . $dashboard->id . " but couldn't delete attribute: $msg");
+ next;
+ }
+
+ $RT::Logger->debug("Reified attribute into a dashboard: $msg");
+ }
+};
+
+ at Final = (
+ sub {
+ my $users = RT::Users->new($RT::SystemUser);
+ $users->UnLimit;
+
+ while (my $user = $users->Next) {
+ $convert_attributes->($user);
+ }
+ },
+ sub {
+ my $groups = RT::Groups->new($RT::SystemUser);
+ $groups->UnLimit;
+
+ while (my $group = $groups->Next) {
+ $convert_attributes->($group);
+ }
+ },
+ sub {
+ my $system = RT::System->new($RT::SystemUser);
+ $convert_attributes->($system);
+ },
+);
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list