summaryrefslogtreecommitdiff
path: root/rt/etc/upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'rt/etc/upgrade')
-rw-r--r--rt/etc/upgrade/3.1.0/acl.Informix4
-rw-r--r--rt/etc/upgrade/3.1.0/schema.Informix17
-rwxr-xr-xrt/etc/upgrade/3.1.0/schema.Pg4
-rwxr-xr-xrt/etc/upgrade/3.1.0/schema.mysql4
-rw-r--r--rt/etc/upgrade/3.3.0/acl.Informix4
-rw-r--r--rt/etc/upgrade/3.3.0/schema.mysql2
-rw-r--r--rt/etc/upgrade/3.7.19/content2
-rw-r--r--rt/etc/upgrade/3.7.86/content4
-rwxr-xr-xrt/etc/upgrade/3.8-branded-queues-extension8
-rwxr-xr-xrt/etc/upgrade/3.8-branded-queues-extension.in4
-rwxr-xr-xrt/etc/upgrade/3.8-ical-extension10
-rw-r--r--rt/etc/upgrade/3.8-ical-extension.in6
-rw-r--r--rt/etc/upgrade/3.8.0/content4
-rw-r--r--rt/etc/upgrade/3.8.1/content4
-rw-r--r--rt/etc/upgrade/3.8.2/content12
-rw-r--r--rt/etc/upgrade/3.8.3/content6
-rw-r--r--rt/etc/upgrade/3.8.4/content6
-rw-r--r--rt/etc/upgrade/3.8.8/content4
-rw-r--r--rt/etc/upgrade/3.8.9/content2
-rwxr-xr-xrt/etc/upgrade/generate-rtaddressregexp46
-rw-r--r--rt/etc/upgrade/generate-rtaddressregexp.in42
-rw-r--r--rt/etc/upgrade/shrink_cgm_table.pl6
-rw-r--r--rt/etc/upgrade/shrink_transactions_table.pl6
-rwxr-xr-xrt/etc/upgrade/split-out-cf-categories22
-rw-r--r--rt/etc/upgrade/split-out-cf-categories.in18
-rwxr-xr-xrt/etc/upgrade/upgrade-mysql-schema.pl41
-rwxr-xr-xrt/etc/upgrade/vulnerable-passwords6
-rwxr-xr-xrt/etc/upgrade/vulnerable-passwords.in2
28 files changed, 170 insertions, 126 deletions
diff --git a/rt/etc/upgrade/3.1.0/acl.Informix b/rt/etc/upgrade/3.1.0/acl.Informix
deleted file mode 100644
index 73c16ae03..000000000
--- a/rt/etc/upgrade/3.1.0/acl.Informix
+++ /dev/null
@@ -1,4 +0,0 @@
-sub acl {
- return ();
-}
-1;
diff --git a/rt/etc/upgrade/3.1.0/schema.Informix b/rt/etc/upgrade/3.1.0/schema.Informix
deleted file mode 100644
index 722eb70b3..000000000
--- a/rt/etc/upgrade/3.1.0/schema.Informix
+++ /dev/null
@@ -1,17 +0,0 @@
-CREATE TABLE Attributes (
- id SERIAL,
- Name VARCHAR(255) DEFAULT '' NOT NULL,
- Description VARCHAR(255) DEFAULT NULL,
- Content BYTE,
- ContentType VARCHAR(16),
- ObjectType VARCHAR(25) NOT NULL,
- ObjectId INTEGER DEFAULT 0 NOT NULL,
- Creator INTEGER DEFAULT 0 NOT NULL,
- Created DATETIME YEAR TO SECOND,
- LastUpdatedBy INTEGER DEFAULT 0 NOT NULL,
- LastUpdated DATETIME YEAR TO SECOND,
- PRIMARY KEY (id)
-);
-
-CREATE INDEX Attributes1 on Attributes(Name);
-CREATE INDEX Attributes2 on Attributes(ObjectType, ObjectId);
diff --git a/rt/etc/upgrade/3.1.0/schema.Pg b/rt/etc/upgrade/3.1.0/schema.Pg
index 94c3fe70d..08a964c4b 100755
--- a/rt/etc/upgrade/3.1.0/schema.Pg
+++ b/rt/etc/upgrade/3.1.0/schema.Pg
@@ -1,4 +1,4 @@
--- {{{ Attributes
+
CREATE SEQUENCE attributes_id_seq;
@@ -21,5 +21,5 @@ CREATE TABLE Attributes (
CREATE INDEX Attributes1 on Attributes(Name);
CREATE INDEX Attributes2 on Attributes(ObjectType, ObjectId);
--- }}}
+
diff --git a/rt/etc/upgrade/3.1.0/schema.mysql b/rt/etc/upgrade/3.1.0/schema.mysql
index c4a345d3e..e4f02c278 100755
--- a/rt/etc/upgrade/3.1.0/schema.mysql
+++ b/rt/etc/upgrade/3.1.0/schema.mysql
@@ -1,4 +1,3 @@
-# {{{ Attributes
CREATE TABLE Attributes (
id INTEGER NOT NULL AUTO_INCREMENT,
@@ -13,9 +12,8 @@ CREATE TABLE Attributes (
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
LastUpdated DATETIME NULL ,
PRIMARY KEY (id)
-) TYPE=InnoDB;
+) ENGINE=InnoDB;
CREATE INDEX Attributes1 on Attributes(Name);
CREATE INDEX Attributes2 on Attributes(ObjectType, ObjectId);
-# }}}
diff --git a/rt/etc/upgrade/3.3.0/acl.Informix b/rt/etc/upgrade/3.3.0/acl.Informix
deleted file mode 100644
index 73c16ae03..000000000
--- a/rt/etc/upgrade/3.3.0/acl.Informix
+++ /dev/null
@@ -1,4 +0,0 @@
-sub acl {
- return ();
-}
-1;
diff --git a/rt/etc/upgrade/3.3.0/schema.mysql b/rt/etc/upgrade/3.3.0/schema.mysql
index 0e33a2819..f6998363e 100644
--- a/rt/etc/upgrade/3.3.0/schema.mysql
+++ b/rt/etc/upgrade/3.3.0/schema.mysql
@@ -45,7 +45,7 @@ CREATE TABLE ObjectCustomFields (
LastUpdatedBy integer NOT NULL DEFAULT 0 ,
LastUpdated DATETIME NULL ,
PRIMARY KEY (id)
-) TYPE=InnoDB;
+) ENGINE=InnoDB;
INSERT into ObjectCustomFields (id, CustomField, ObjectId, SortOrder, Creator, LastUpdatedBy) SELECT null, id, Queue, SortOrder, Creator, LastUpdatedBy from CustomFields;
diff --git a/rt/etc/upgrade/3.7.19/content b/rt/etc/upgrade/3.7.19/content
index ac34ebeb5..31ab1c84a 100644
--- a/rt/etc/upgrade/3.7.19/content
+++ b/rt/etc/upgrade/3.7.19/content
@@ -4,7 +4,7 @@ add_description_to_all_scrips();
sub add_description_to_all_scrips {
require RT::Scrips;
- my $scrips = RT::Scrips->new( $RT::SystemUser );
+ my $scrips = RT::Scrips->new( RT->SystemUser );
$scrips->Limit( FIELD => 'Description', OPERATOR => 'IS', VALUE => 'NULL' );
$scrips->Limit( FIELD => 'Description', VALUE => '' );
while ( my $scrip = $scrips->Next ) {
diff --git a/rt/etc/upgrade/3.7.86/content b/rt/etc/upgrade/3.7.86/content
index da087ed75..94912d626 100644
--- a/rt/etc/upgrade/3.7.86/content
+++ b/rt/etc/upgrade/3.7.86/content
@@ -1,9 +1,9 @@
@Final = (
sub {
$RT::Logger->debug("Adding search for bookmarked tickets to defaults");
- my $sys = RT::System->new($RT::SystemUser);
+ my $sys = RT::System->new(RT->SystemUser);
- my $attrs = RT::Attributes->new( $RT::SystemUser );
+ my $attrs = RT::Attributes->new( RT->SystemUser );
$attrs->LimitToObject( $sys );
my ($attr) = $attrs->Named( 'HomepageSettings' );
unless ($attr) {
diff --git a/rt/etc/upgrade/3.8-branded-queues-extension b/rt/etc/upgrade/3.8-branded-queues-extension
index b3785342f..08eebad06 100755
--- a/rt/etc/upgrade/3.8-branded-queues-extension
+++ b/rt/etc/upgrade/3.8-branded-queues-extension
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -49,8 +49,8 @@
use strict;
use warnings;
-use lib "local/lib";
-use lib "lib";
+use lib "/opt/rt3/local/lib";
+use lib "/opt/rt3/lib";
use RT;
@@ -59,7 +59,7 @@ RT::Init();
use RT::Queues;
-my $queues = RT::Queues->new( $RT::SystemUser );
+my $queues = RT::Queues->new( RT->SystemUser );
$queues->UnLimit();
while ( my $queue = $queues->Next ) {
print "Processing queue ". ($queue->Name || $queue->id) ."...\n";
diff --git a/rt/etc/upgrade/3.8-branded-queues-extension.in b/rt/etc/upgrade/3.8-branded-queues-extension.in
index dece470d4..8c9f58ded 100755
--- a/rt/etc/upgrade/3.8-branded-queues-extension.in
+++ b/rt/etc/upgrade/3.8-branded-queues-extension.in
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -59,7 +59,7 @@ RT::Init();
use RT::Queues;
-my $queues = RT::Queues->new( $RT::SystemUser );
+my $queues = RT::Queues->new( RT->SystemUser );
$queues->UnLimit();
while ( my $queue = $queues->Next ) {
print "Processing queue ". ($queue->Name || $queue->id) ."...\n";
diff --git a/rt/etc/upgrade/3.8-ical-extension b/rt/etc/upgrade/3.8-ical-extension
index a241ee2a1..fa6cfd003 100755
--- a/rt/etc/upgrade/3.8-ical-extension
+++ b/rt/etc/upgrade/3.8-ical-extension
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -49,8 +49,8 @@
use strict;
use warnings;
-use lib "local/lib";
-use lib "lib";
+use lib "/opt/rt3/local/lib";
+use lib "/opt/rt3/lib";
use RT;
@@ -58,14 +58,14 @@ RT::LoadConfig();
RT::Init();
use RT::Attributes;
-my $attrs = RT::Attributes->new( $RT::SystemUser );
+my $attrs = RT::Attributes->new( RT->SystemUser );
$attrs->Limit(FIELD => 'ObjectType', OPERATOR=> '=', VALUE => 'RT::User');
$attrs->Limit(FIELD => 'Name', OPERATOR=> '=', VALUE => 'ical-auth-token');
while ( my $attr = $attrs->Next ) {
my $uid = $attr->ObjectId;
print "Processing auth token of user #". $uid ."...\n";
- my $user = RT::User->new( $RT::SystemUser );
+ my $user = RT::User->new( RT->SystemUser );
$user->Load( $uid );
unless ( $user->id ) {
print STDERR "\tERROR. Couldn't load user record\n";
diff --git a/rt/etc/upgrade/3.8-ical-extension.in b/rt/etc/upgrade/3.8-ical-extension.in
index 45b14a6eb..af95a96d9 100644
--- a/rt/etc/upgrade/3.8-ical-extension.in
+++ b/rt/etc/upgrade/3.8-ical-extension.in
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -58,14 +58,14 @@ RT::LoadConfig();
RT::Init();
use RT::Attributes;
-my $attrs = RT::Attributes->new( $RT::SystemUser );
+my $attrs = RT::Attributes->new( RT->SystemUser );
$attrs->Limit(FIELD => 'ObjectType', OPERATOR=> '=', VALUE => 'RT::User');
$attrs->Limit(FIELD => 'Name', OPERATOR=> '=', VALUE => 'ical-auth-token');
while ( my $attr = $attrs->Next ) {
my $uid = $attr->ObjectId;
print "Processing auth token of user #". $uid ."...\n";
- my $user = RT::User->new( $RT::SystemUser );
+ my $user = RT::User->new( RT->SystemUser );
$user->Load( $uid );
unless ( $user->id ) {
print STDERR "\tERROR. Couldn't load user record\n";
diff --git a/rt/etc/upgrade/3.8.0/content b/rt/etc/upgrade/3.8.0/content
index f4e389b90..4fa5ac7d8 100644
--- a/rt/etc/upgrade/3.8.0/content
+++ b/rt/etc/upgrade/3.8.0/content
@@ -3,9 +3,9 @@
# 3.7.82 upgrade script still was creating 'My Bookmarks', try to fix it
sub {
$RT::Logger->debug("Going to rename 'My Bookmarks' to 'Bookmarked Tickets'");
- my $sys = RT::System->new($RT::SystemUser);
+ my $sys = RT::System->new(RT->SystemUser);
- my $attrs = RT::Attributes->new( $RT::SystemUser );
+ my $attrs = RT::Attributes->new( RT->SystemUser );
$attrs->LimitToObject( $sys );
my ($attr) = $attrs->Named( 'Search - My Bookmarks' );
unless ($attr) {
diff --git a/rt/etc/upgrade/3.8.1/content b/rt/etc/upgrade/3.8.1/content
index 89db596ec..1667efa78 100644
--- a/rt/etc/upgrade/3.8.1/content
+++ b/rt/etc/upgrade/3.8.1/content
@@ -1,9 +1,9 @@
@Final = (
sub {
$RT::Logger->debug("Going to adjust 'Bookmarked Tickets'");
- my $sys = RT::System->new($RT::SystemUser);
+ my $sys = RT::System->new(RT->SystemUser);
- my $attrs = RT::Attributes->new( $RT::SystemUser );
+ my $attrs = RT::Attributes->new( RT->SystemUser );
$attrs->LimitToObject( $sys );
my ($attr) = $attrs->Named( 'Search - Bookmarked Tickets' );
unless ($attr) {
diff --git a/rt/etc/upgrade/3.8.2/content b/rt/etc/upgrade/3.8.2/content
index d8f54e9ba..0eef401b8 100644
--- a/rt/etc/upgrade/3.8.2/content
+++ b/rt/etc/upgrade/3.8.2/content
@@ -7,14 +7,14 @@
." you may eventually want to start using approvals."
);
- my $approvals_q = RT::Queue->new( $RT::SystemUser );
+ my $approvals_q = RT::Queue->new( RT->SystemUser );
$approvals_q->Load('___Approvals');
unless ( $approvals_q->id ) {
$RT::Logger->error("You have no approvals queue.");
return 1;
}
- my $templates = RT::Templates->new( $RT::SystemUser );
+ my $templates = RT::Templates->new( RT->SystemUser );
$templates->LimitToQueue( $approvals_q->id );
while ( my $tmpl = $templates->Next ) {
my ($status, $msg) = $tmpl->SetName( "[OLD] ". $tmpl->Name );
@@ -109,9 +109,9 @@ The ticket has been approved, you may now start to act on it.
@Final = (
sub {
$RT::Logger->debug("Going to adjust dashboards");
- my $sys = RT::System->new($RT::SystemUser);
+ my $sys = RT::System->new(RT->SystemUser);
- my $attrs = RT::Attributes->new( $RT::SystemUser );
+ my $attrs = RT::Attributes->new( RT->SystemUser );
$attrs->UnLimit;
my @dashboards = $attrs->Named('Dashboard');
@@ -147,7 +147,7 @@ The ticket has been approved, you may now start to act on it.
return 1;
},
sub {
- my $approvals_q = RT::Queue->new( $RT::SystemUser );
+ my $approvals_q = RT::Queue->new( RT->SystemUser );
$approvals_q->Load('___Approvals');
unless ( $approvals_q->id ) {
$RT::Logger->error("You have no approvals queue.");
@@ -168,7 +168,7 @@ The ticket has been approved, you may now start to act on it.
require Data::Dumper;
- my $scrips = RT::Scrips->new( $RT::SystemUser );
+ my $scrips = RT::Scrips->new( RT->SystemUser );
$scrips->LimitToQueue( $approvals_q->id );
while ( my $scrip = $scrips->Next ) {
my %tmp =
diff --git a/rt/etc/upgrade/3.8.3/content b/rt/etc/upgrade/3.8.3/content
index 8538e4287..b8052acde 100644
--- a/rt/etc/upgrade/3.8.3/content
+++ b/rt/etc/upgrade/3.8.3/content
@@ -12,7 +12,7 @@
sub {
$RT::Logger->debug("Going to correct descriptions of notify actions in the DB");
- my $actions = RT::ScripActions->new( $RT::SystemUser );
+ my $actions = RT::ScripActions->new( RT->SystemUser );
$actions->Limit(
FIELD => 'ExecModule',
VALUE => 'Notify',
@@ -31,7 +31,7 @@
unless $status;
}
- $actions = RT::ScripActions->new( $RT::SystemUser );
+ $actions = RT::ScripActions->new( RT->SystemUser );
$actions->Limit(
FIELD => 'ExecModule',
VALUE => 'NotifyAsComment',
@@ -59,7 +59,7 @@
{
$RT::Logger->debug("Going to add in Extract Subject Tag actions if they were missed during a previous upgrade");
-$actions = RT::ScripActions->new( $RT::SystemUser );
+$actions = RT::ScripActions->new( RT->SystemUser );
$actions->Limit(
FIELD => 'ExecModule',
VALUE => 'ExtractSubjectTag',
diff --git a/rt/etc/upgrade/3.8.4/content b/rt/etc/upgrade/3.8.4/content
index be5a6bf39..38d551450 100644
--- a/rt/etc/upgrade/3.8.4/content
+++ b/rt/etc/upgrade/3.8.4/content
@@ -4,7 +4,7 @@
$RT::Logger->debug("Going to correct arguments of NotifyGroup actions if you have any");
use strict;
- my $actions = RT::ScripActions->new( $RT::SystemUser );
+ my $actions = RT::ScripActions->new( RT->SystemUser );
$actions->Limit(
FIELD => 'ExecModule',
VALUE => 'NotifyGroup',
@@ -21,9 +21,9 @@
my $obj;
next unless $r->{'Type'};
if( lc $r->{'Type'} eq 'user' ) {
- $obj = RT::User->new( $RT::SystemUser );
+ $obj = RT::User->new( RT->SystemUser );
} elsif ( lc $r->{'Type'} eq 'group' ) {
- $obj = RT::Group->new( $RT::SystemUser );
+ $obj = RT::Group->new( RT->SystemUser );
} else {
next;
}
diff --git a/rt/etc/upgrade/3.8.8/content b/rt/etc/upgrade/3.8.8/content
index ee1943304..cad77e948 100644
--- a/rt/etc/upgrade/3.8.8/content
+++ b/rt/etc/upgrade/3.8.8/content
@@ -1,7 +1,7 @@
@Initial = (
sub {
# make sure global CFs are not applied to local objects
- my $ocfs = RT::ObjectCustomFields->new( $RT::SystemUser );
+ my $ocfs = RT::ObjectCustomFields->new( RT->SystemUser );
$ocfs->Limit( FIELD => 'ObjectId', OPERATOR => '!=', VALUE => 0 );
my $alias = $ocfs->Join(
FIELD1 => 'CustomField',
@@ -26,7 +26,7 @@
my ($i, $prev_type) = (0, '');
while ( my ($lt, $id) = $sth->fetchrow_array ) {
$i = 0 if $prev_type ne $lt;
- my $ocf = RT::ObjectCustomField->new( $RT::SystemUser );
+ my $ocf = RT::ObjectCustomField->new( RT->SystemUser );
$ocf->Load( $id );
my ($status, $msg) = $ocf->SetSortOrder( $i++ );
$RT::Logger->warning("Couldn't set SortOrder: $msg")
diff --git a/rt/etc/upgrade/3.8.9/content b/rt/etc/upgrade/3.8.9/content
index 8a28f7dce..898c19ebf 100644
--- a/rt/etc/upgrade/3.8.9/content
+++ b/rt/etc/upgrade/3.8.9/content
@@ -10,7 +10,7 @@
my $found;
do {
$found = 0;
- my $links = RT::Links->new( $RT::SystemUser );
+ my $links = RT::Links->new( RT->SystemUser );
$links->Limit( FIELD => $dir, OPERATOR => 'STARTSWITH', VALUE => $prefix );
$links->Limit( FIELD => 'Local'.$dir, VALUE => 0 );
$links->Limit(
diff --git a/rt/etc/upgrade/generate-rtaddressregexp b/rt/etc/upgrade/generate-rtaddressregexp
index adffab9cd..443dd7cf8 100755
--- a/rt/etc/upgrade/generate-rtaddressregexp
+++ b/rt/etc/upgrade/generate-rtaddressregexp
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -49,8 +49,8 @@
use strict;
use warnings;
-use lib "local/lib";
-use lib "lib";
+use lib "/opt/rt3/local/lib";
+use lib "/opt/rt3/lib";
use RT;
RT::LoadConfig();
@@ -65,23 +65,45 @@ if (my $re = RT->Config->Get('RTAddressRegexp')) {
}
use RT::Queues;
-my $queues = RT::Queues->new( $RT::SystemUser );
+my $queues = RT::Queues->new( RT->SystemUser );
$queues->UnLimit;
-$queues->RowsPerPage(100);
-my @addresses = (RT->Config->Get('CorrespondAddress'), RT->Config->Get('CommentAddress'));
+my %merged;
+merge(\%merged, RT->Config->Get('CorrespondAddress'), RT->Config->Get('CommentAddress'));
while ( my $queue = $queues->Next ) {
- push @addresses, $queue->CorrespondAddress, $queue->CommentAddress;
+ merge(\%merged, $queue->CorrespondAddress, $queue->CommentAddress);
}
-my %seen;
-my $re = join '|', map "\Q$_\E",
- grep defined && length && !$seen{ lc $_ }++,
- @addresses;
+my @domains;
+for my $domain (sort keys %merged) {
+ my @addresses;
+ for my $base (sort keys %{$merged{$domain}}) {
+ my @subbits = keys(%{$merged{$domain}{$base}});
+ if (@subbits > 1) {
+ push @addresses, "\Q$base\E(?:".join("|",@subbits).")";
+ } else {
+ push @addresses, "\Q$base\E$subbits[0]";
+ }
+ }
+ if (@addresses > 1) {
+ push @domains, "(?:".join("|", @addresses).")\Q\@".$domain."\E";
+ } else {
+ push @domains, "$addresses[0]\Q\@$domain\E";
+ }
+}
+my $re = join "|", @domains;
print <<ENDDESCRIPTION;
You can add the following to RT_SiteConfig.pm, but may want to collapse it into a more efficient regexp.
Keep in mind that this only contains the email addresses that RT knows about, you should also examine
your mail system for aliases that reach RT but which RT doesn't know about.
ENDDESCRIPTION
-print "Set(\$RTAddressRegexp,'^(?:${re})\$');\n";
+print "Set(\$RTAddressRegexp,qr{^(?:${re})\$}i);\n";
+
+sub merge {
+ my $merged = shift;
+ for my $address (grep {defined and length} @_) {
+ $address =~ /^\s*(.*?)(-comments?)?\@(.*?)\s*$/;
+ $merged->{lc $3}{$1}{$2||''}++;
+ }
+}
diff --git a/rt/etc/upgrade/generate-rtaddressregexp.in b/rt/etc/upgrade/generate-rtaddressregexp.in
index a0787ca15..68259ff94 100644
--- a/rt/etc/upgrade/generate-rtaddressregexp.in
+++ b/rt/etc/upgrade/generate-rtaddressregexp.in
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -65,23 +65,45 @@ if (my $re = RT->Config->Get('RTAddressRegexp')) {
}
use RT::Queues;
-my $queues = RT::Queues->new( $RT::SystemUser );
+my $queues = RT::Queues->new( RT->SystemUser );
$queues->UnLimit;
-$queues->RowsPerPage(100);
-my @addresses = (RT->Config->Get('CorrespondAddress'), RT->Config->Get('CommentAddress'));
+my %merged;
+merge(\%merged, RT->Config->Get('CorrespondAddress'), RT->Config->Get('CommentAddress'));
while ( my $queue = $queues->Next ) {
- push @addresses, $queue->CorrespondAddress, $queue->CommentAddress;
+ merge(\%merged, $queue->CorrespondAddress, $queue->CommentAddress);
}
-my %seen;
-my $re = join '|', map "\Q$_\E",
- grep defined && length && !$seen{ lc $_ }++,
- @addresses;
+my @domains;
+for my $domain (sort keys %merged) {
+ my @addresses;
+ for my $base (sort keys %{$merged{$domain}}) {
+ my @subbits = keys(%{$merged{$domain}{$base}});
+ if (@subbits > 1) {
+ push @addresses, "\Q$base\E(?:".join("|",@subbits).")";
+ } else {
+ push @addresses, "\Q$base\E$subbits[0]";
+ }
+ }
+ if (@addresses > 1) {
+ push @domains, "(?:".join("|", @addresses).")\Q\@".$domain."\E";
+ } else {
+ push @domains, "$addresses[0]\Q\@$domain\E";
+ }
+}
+my $re = join "|", @domains;
print <<ENDDESCRIPTION;
You can add the following to RT_SiteConfig.pm, but may want to collapse it into a more efficient regexp.
Keep in mind that this only contains the email addresses that RT knows about, you should also examine
your mail system for aliases that reach RT but which RT doesn't know about.
ENDDESCRIPTION
-print "Set(\$RTAddressRegexp,'^(?:${re})\$');\n";
+print "Set(\$RTAddressRegexp,qr{^(?:${re})\$}i);\n";
+
+sub merge {
+ my $merged = shift;
+ for my $address (grep {defined and length} @_) {
+ $address =~ /^\s*(.*?)(-comments?)?\@(.*?)\s*$/;
+ $merged->{lc $3}{$1}{$2||''}++;
+ }
+}
diff --git a/rt/etc/upgrade/shrink_cgm_table.pl b/rt/etc/upgrade/shrink_cgm_table.pl
index 0ce3d287b..cf39d04d7 100644
--- a/rt/etc/upgrade/shrink_cgm_table.pl
+++ b/rt/etc/upgrade/shrink_cgm_table.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -56,7 +56,7 @@ RT->Config->Set('LogToScreen' => 'debug');
RT::Init();
use RT::CachedGroupMembers;
-my $cgms = RT::CachedGroupMembers->new( $RT::SystemUser );
+my $cgms = RT::CachedGroupMembers->new( RT->SystemUser );
$cgms->Limit(
FIELD => 'id',
OPERATOR => '!=',
diff --git a/rt/etc/upgrade/shrink_transactions_table.pl b/rt/etc/upgrade/shrink_transactions_table.pl
index b4f2e1907..c23d09188 100644
--- a/rt/etc/upgrade/shrink_transactions_table.pl
+++ b/rt/etc/upgrade/shrink_transactions_table.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -56,7 +56,7 @@ RT->Config->Set('LogToScreen' => 'debug');
RT::Init();
use RT::Transactions;
-my $txns = RT::Transactions->new( $RT::SystemUser );
+my $txns = RT::Transactions->new( RT->SystemUser );
$txns->Limit(
FIELD => 'ObjectType',
OPERATOR => '=',
diff --git a/rt/etc/upgrade/split-out-cf-categories b/rt/etc/upgrade/split-out-cf-categories
index 23169f43c..a5c354d3d 100755
--- a/rt/etc/upgrade/split-out-cf-categories
+++ b/rt/etc/upgrade/split-out-cf-categories
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -49,8 +49,8 @@
use strict;
use warnings;
-use lib "local/lib";
-use lib "lib";
+use lib "/opt/rt3/local/lib";
+use lib "/opt/rt3/lib";
use RT;
RT::LoadConfig();
@@ -62,7 +62,7 @@ $| = 1;
$RT::Handle->BeginTransaction();
use RT::CustomFields;
-my $CFs = RT::CustomFields->new( $RT::SystemUser );
+my $CFs = RT::CustomFields->new( RT->SystemUser );
$CFs->UnLimit;
$CFs->Limit( FIELD => 'Type', VALUE => 'Select' );
@@ -96,7 +96,7 @@ while (my $cf = $CFs->Next ) {
$cf->SetSortOrder( ($cf->SortOrder || 0) + 1 );
# ..and add a new CF before it
- my $new = RT::CustomField->new( $RT::SystemUser );
+ my $new = RT::CustomField->new( RT->SystemUser );
my ($id, $msg) = $new->Create(
Name => $newname,
Type => 'Select',
@@ -111,10 +111,10 @@ while (my $cf = $CFs->Next ) {
# Apply it to all of the same things
{
- my $ocfs = RT::ObjectCustomFields->new( $RT::SystemUser );
+ my $ocfs = RT::ObjectCustomFields->new( RT->SystemUser );
$ocfs->LimitToCustomField( $cf->Id );
while (my $ocf = $ocfs->Next) {
- my $newocf = RT::ObjectCustomField->new( $RT::SystemUser );
+ my $newocf = RT::ObjectCustomField->new( RT->SystemUser );
($id, $msg) = $newocf->Create(
SortOrder => $ocf->SortOrder,
CustomField => $new->Id,
@@ -126,10 +126,10 @@ while (my $cf = $CFs->Next ) {
# Copy over all of the rights
{
- my $acl = RT::ACL->new( $RT::SystemUser );
+ my $acl = RT::ACL->new( RT->SystemUser );
$acl->LimitToObject( $cf );
while (my $ace = $acl->Next) {
- my $newace = RT::ACE->new( $RT::SystemUser );
+ my $newace = RT::ACE->new( RT->SystemUser );
($id, $msg) = $newace->Create(
PrincipalId => $ace->PrincipalId,
PrincipalType => $ace->PrincipalType,
@@ -152,11 +152,11 @@ while (my $cf = $CFs->Next ) {
# Grovel through all ObjectCustomFieldValues, and add the
# appropriate category
{
- my $ocfvs = RT::ObjectCustomFieldValues->new( $RT::SystemUser );
+ my $ocfvs = RT::ObjectCustomFieldValues->new( RT->SystemUser );
$ocfvs->LimitToCustomField( $cf->Id );
while (my $ocfv = $ocfvs->Next) {
next unless exists $mapping{$ocfv->Content};
- my $newocfv = RT::ObjectCustomFieldValue->new( $RT::SystemUser );
+ my $newocfv = RT::ObjectCustomFieldValue->new( RT->SystemUser );
($id, $msg) = $newocfv->Create(
CustomField => $new->Id,
ObjectType => $ocfv->ObjectType,
diff --git a/rt/etc/upgrade/split-out-cf-categories.in b/rt/etc/upgrade/split-out-cf-categories.in
index 9d157b4f5..28ea309de 100644
--- a/rt/etc/upgrade/split-out-cf-categories.in
+++ b/rt/etc/upgrade/split-out-cf-categories.in
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -62,7 +62,7 @@ $| = 1;
$RT::Handle->BeginTransaction();
use RT::CustomFields;
-my $CFs = RT::CustomFields->new( $RT::SystemUser );
+my $CFs = RT::CustomFields->new( RT->SystemUser );
$CFs->UnLimit;
$CFs->Limit( FIELD => 'Type', VALUE => 'Select' );
@@ -96,7 +96,7 @@ while (my $cf = $CFs->Next ) {
$cf->SetSortOrder( ($cf->SortOrder || 0) + 1 );
# ..and add a new CF before it
- my $new = RT::CustomField->new( $RT::SystemUser );
+ my $new = RT::CustomField->new( RT->SystemUser );
my ($id, $msg) = $new->Create(
Name => $newname,
Type => 'Select',
@@ -111,10 +111,10 @@ while (my $cf = $CFs->Next ) {
# Apply it to all of the same things
{
- my $ocfs = RT::ObjectCustomFields->new( $RT::SystemUser );
+ my $ocfs = RT::ObjectCustomFields->new( RT->SystemUser );
$ocfs->LimitToCustomField( $cf->Id );
while (my $ocf = $ocfs->Next) {
- my $newocf = RT::ObjectCustomField->new( $RT::SystemUser );
+ my $newocf = RT::ObjectCustomField->new( RT->SystemUser );
($id, $msg) = $newocf->Create(
SortOrder => $ocf->SortOrder,
CustomField => $new->Id,
@@ -126,10 +126,10 @@ while (my $cf = $CFs->Next ) {
# Copy over all of the rights
{
- my $acl = RT::ACL->new( $RT::SystemUser );
+ my $acl = RT::ACL->new( RT->SystemUser );
$acl->LimitToObject( $cf );
while (my $ace = $acl->Next) {
- my $newace = RT::ACE->new( $RT::SystemUser );
+ my $newace = RT::ACE->new( RT->SystemUser );
($id, $msg) = $newace->Create(
PrincipalId => $ace->PrincipalId,
PrincipalType => $ace->PrincipalType,
@@ -152,11 +152,11 @@ while (my $cf = $CFs->Next ) {
# Grovel through all ObjectCustomFieldValues, and add the
# appropriate category
{
- my $ocfvs = RT::ObjectCustomFieldValues->new( $RT::SystemUser );
+ my $ocfvs = RT::ObjectCustomFieldValues->new( RT->SystemUser );
$ocfvs->LimitToCustomField( $cf->Id );
while (my $ocfv = $ocfvs->Next) {
next unless exists $mapping{$ocfv->Content};
- my $newocfv = RT::ObjectCustomFieldValue->new( $RT::SystemUser );
+ my $newocfv = RT::ObjectCustomFieldValue->new( RT->SystemUser );
($id, $msg) = $newocfv->Create(
CustomField => $new->Id,
ObjectType => $ocfv->ObjectType,
diff --git a/rt/etc/upgrade/upgrade-mysql-schema.pl b/rt/etc/upgrade/upgrade-mysql-schema.pl
index 4a104b60f..310a6a826 100755
--- a/rt/etc/upgrade/upgrade-mysql-schema.pl
+++ b/rt/etc/upgrade/upgrade-mysql-schema.pl
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# BEGIN BPS TAGGED BLOCK {{{
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -104,6 +104,10 @@ my @tables = qw(
Tickets
Transactions
Users
+ FM_Articles
+ FM_Classes
+ FM_ObjectTopics
+ FM_Topics
);
my %charset = (
@@ -139,6 +143,23 @@ my %charset = (
Name => 'utf8',
Description => 'utf8',
},
+ FM_Articles => {
+ Name => 'utf8',
+ Summary => 'utf8',
+ URI => 'ascii',
+ },
+ FM_Classes => {
+ Name => 'utf8',
+ Description => 'utf8',
+ },
+ FM_ObjectTopics => {
+ ObjectType => 'ascii',
+ },
+ FM_Topics => {
+ Name => 'utf8',
+ Description => 'utf8',
+ ObjectType => 'ascii',
+ },
Groups => {
Name => 'utf8',
Description => 'utf8',
@@ -265,7 +286,7 @@ $db_name =~ s/:.*$//;
my $version = ($dbh->selectrow_array("show variables like 'version'"))[1];
($version) = $version =~ /^(\d+\.\d+)/;
-push @sql_commands, qq{ALTER DATABASE $db_name DEFAULT CHARACTER SET utf8};
+push @sql_commands, qq{ALTER DATABASE `$db_name` DEFAULT CHARACTER SET utf8};
convert_table($_) foreach @tables;
print join "\n", map(/;$/? $_ : "$_;", @sql_commands), "";
@@ -285,7 +306,9 @@ sub convert_table {
my $sth = $dbh->column_info( undef, $db_name, $table, undef );
$sth->execute;
- while ( my $info = $sth->fetchrow_hashref ) {
+ my $columns = $sth->fetchall_arrayref({});
+ return unless @$columns;
+ foreach my $info (@$columns) {
convert_column(%$info);
}
for my $conversiontype (qw(char_to_binary binary_to_char)) {
@@ -416,11 +439,15 @@ sub build_column_definition {
sub column_byte_length {
my ($table, $column) = @_;
if ( $version >= 5.0 ) {
+ # information_schema searches can be case sensitive
+ # and users may use lower_case_table_names, use LOWER
+ # for everything just in case
+ # http://dev.mysql.com/doc/refman/5.1/en/charset-collation-information-schema.html
my ($char, $octet) = @{ $dbh->selectrow_arrayref(
"SELECT CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH FROM information_schema.COLUMNS WHERE"
- ." TABLE_SCHEMA = ". $dbh->quote($db_name)
- ." AND TABLE_NAME = ". $dbh->quote($table)
- ." AND COLUMN_NAME = ". $dbh->quote($column)
+ ." LOWER(TABLE_SCHEMA) = ". lc( $dbh->quote($db_name) )
+ ." AND LOWER(TABLE_NAME) = ". lc( $dbh->quote($table) )
+ ." AND LOWER(COLUMN_NAME) = ". lc( $dbh->quote($column) )
) };
return $octet if $octet == $char;
}
diff --git a/rt/etc/upgrade/vulnerable-passwords b/rt/etc/upgrade/vulnerable-passwords
index f0fed0cfe..71457b149 100755
--- a/rt/etc/upgrade/vulnerable-passwords
+++ b/rt/etc/upgrade/vulnerable-passwords
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -49,8 +49,8 @@
use strict;
use warnings;
-use lib "local/lib";
-use lib "lib";
+use lib "/opt/rt3/local/lib";
+use lib "/opt/rt3/lib";
use RT;
RT::LoadConfig;
diff --git a/rt/etc/upgrade/vulnerable-passwords.in b/rt/etc/upgrade/vulnerable-passwords.in
index 0af2b6423..728786fb6 100755
--- a/rt/etc/upgrade/vulnerable-passwords.in
+++ b/rt/etc/upgrade/vulnerable-passwords.in
@@ -3,7 +3,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)