[Rt-commit] [svn] r1604 - in rtir/branches/1.1-TESTING: . etc/upgrade

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Fri Oct 1 02:58:38 EDT 2004


Author: leira
Date: Fri Oct  1 02:58:37 2004
New Revision: 1604

Added:
   rtir/branches/1.1-TESTING/etc/upgrade/upgrade.pl
Modified:
   rtir/branches/1.1-TESTING/UPGRADING
Log:
RT-Ticket: 6151
RT-Status: resolved
RT-Action: correspond
Added script for updating due dates of Incidents, based on due date of children.  Updated UPGRADING file to instruct users to run this script when upgrading.


Modified: rtir/branches/1.1-TESTING/UPGRADING
==============================================================================
--- rtir/branches/1.1-TESTING/UPGRADING	(original)
+++ rtir/branches/1.1-TESTING/UPGRADING	Fri Oct  1 02:58:37 2004
@@ -30,9 +30,11 @@
 Then, proceed with the installation instructions in the README.  Do
 not re-initialize the database.
 
-After you have followed the installation instructions in the README,
-you must delete the following Scrips (go to Configuration / Queues /
-<Queue Name> / Scrips):
+After you have followed the installation instructions in the
+README, you must do the following:
+
+1) Delete the following Scrips (go to Configuration / Queues / <Queue
+Name> / Scrips):
 
 In the Incidents Queue:
   SetStartsDate
@@ -74,7 +76,9 @@
   FixOwnership
   ReopenIncident
 
-Then, type "make upgrade" and follow the instructions.
+2) Run the etc/upgrade/upgrade.pl script.
+
+3) Then, type "make upgrade" and follow the instructions.
 
 Upgrading from RTIR 1.1.2:
 --------------------------

Added: rtir/branches/1.1-TESTING/etc/upgrade/upgrade.pl
==============================================================================
--- (empty file)
+++ rtir/branches/1.1-TESTING/etc/upgrade/upgrade.pl	Fri Oct  1 02:58:37 2004
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use lib ("/opt/rt3/lib", "/opt/rt3/local/lib");
+
+use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc); 
+use RT::Tickets; 
+use RT::Template;
+
+#Clean out all the nasties from the environment
+CleanEnv();
+
+# Load the config file
+RT::LoadConfig();
+
+#Connect to the database and get RT::SystemUser and RT::Nobody loaded
+RT::Init();
+
+# Get the open incidents with no due dates
+my $incidents = new RT::Tickets(GetCurrentUser());
+$incidents->FromSQL("Queue = 'Incidents' AND Due <= '1970-01-01' AND (Status = 'new' OR Status = 'open')");
+
+# Get the children for each Incident
+my $children = new RT::Tickets(GetCurrentUser());
+while (my $inc = $incidents->Next) {
+    $children->FromSQL("MemberOf = " . $inc->Id . " AND (Queue = 'Incident Reports' OR Queue = 'Investigations' OR Queue = 'Blocks') AND (Status = 'new' OR Status = 'open')");
+    $children->OrderBy(FIELD => 'Due', ORDER => 'ASC');
+
+    # Find the most due child
+    my $child = $children->First;
+    next unless $child;
+
+    # Set the due date of the Incident to the due date of the child
+    $inc->SetDue($child->DueObj->ISO);
+}
+


More information about the Rt-commit mailing list