[Rt-commit] rt branch, 4.2/strict-upgrade-scripts, created. rt-4.0.1-251-g71864b4

Ruslan Zakirov ruz at bestpractical.com
Wed Aug 3 21:11:33 EDT 2011


The branch, 4.2/strict-upgrade-scripts has been created
        at  71864b448ea7b6a0c2aab45be6eed97e5d10393c (commit)

- Log -----------------------------------------------------------------
commit cedc4ffcd73ebfedf17ae66e70744d6e1b3ac2d4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 04:00:19 2011 +0400

    turn open function call into @Final

diff --git a/etc/upgrade/3.7.19/content b/etc/upgrade/3.7.19/content
index 31ab1c8..e529b82 100644
--- a/etc/upgrade/3.7.19/content
+++ b/etc/upgrade/3.7.19/content
@@ -1,26 +1,24 @@
+ at Final = (
+    sub {
+        require RT::Scrips;
+        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 ) {
+            my $desc = $scrip->Description;
+            next if defined $desc && length $desc;
 
-{ use strict;
-add_description_to_all_scrips();
+            $desc = gen_scrip_description( $scrip );
 
-sub add_description_to_all_scrips {
-    require RT::Scrips;
-    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 ) {
-        my $desc = $scrip->Description;
-        next if defined $desc && length $desc;
-
-        $desc = gen_scrip_description( $scrip );
-
-        my ($status, $msg) = $scrip->SetDescription( $desc );
-        unless ( $status ) {
-            print STDERR "Couldn't set description of a scrip: $msg";
-        } else {
-            print "Added description to scrip #". $scrip->id ."\n";
+            my ($status, $msg) = $scrip->SetDescription( $desc );
+            unless ( $status ) {
+                print STDERR "Couldn't set description of a scrip: $msg";
+            } else {
+                print "Added description to scrip #". $scrip->id ."\n";
+            }
         }
-    }
-}
+    },
+);
 
 sub gen_scrip_description {
     my $scrip = shift;
@@ -32,6 +30,5 @@ sub gen_scrip_description {
         || ('Run Action #'. $scrip->Action);
     return join ' ', $condition, $action;
 }
-}
 
 1;

commit 946158cb0a0c15f8440de7c91a920920e0d32864
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 04:01:25 2011 +0400

    delete empty upgrade/*/content files

diff --git a/etc/upgrade/3.1.0/content b/etc/upgrade/3.1.0/content
deleted file mode 100644
index 3117daf..0000000
--- a/etc/upgrade/3.1.0/content
+++ /dev/null
@@ -1,2 +0,0 @@
-# nothing to do
-1;
diff --git a/etc/upgrade/3.3.0/content b/etc/upgrade/3.3.0/content
deleted file mode 100644
index 0afc604..0000000
--- a/etc/upgrade/3.3.0/content
+++ /dev/null
@@ -1 +0,0 @@
-1;
diff --git a/etc/upgrade/3.3.11/content b/etc/upgrade/3.3.11/content
deleted file mode 100644
index 0afc604..0000000
--- a/etc/upgrade/3.3.11/content
+++ /dev/null
@@ -1 +0,0 @@
-1;

commit 30b8be168688cee1f69cd602c35e4891d3bcff45
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 04:37:17 2011 +0400

    test upgrade/*/content files

diff --git a/t/upgrade/compile.t b/t/upgrade/compile.t
new file mode 100644
index 0000000..5c58b3c
--- /dev/null
+++ b/t/upgrade/compile.t
@@ -0,0 +1,40 @@
+use strict;
+use warnings;
+
+use Test::More;
+use IPC::Run3;
+
+my @files = files();
+plan tests => 1 + @files * 3;
+
+ok( scalar @files, "found content files" );
+
+test_it($_) foreach @files;
+
+sub test_it {
+    my $file = shift;
+
+    my ($input, $output, $error) = ('', '', '');
+    run3(
+        [$^X, '-Ilib', '-Mstrict', '-Mwarnings', '-c', $file],
+        \$input, \$output, \$error,
+    );
+    is $error, "$file syntax OK\n", "syntax is OK";
+
+    open my $fh, "<", $file or die "$!";
+    my ($first, $second) = (grep /\S/, map { chomp; $_ } <$fh>);
+    close $fh;
+
+    is $first, 'use strict;', 'first not empty line is "use strict;"';
+    is $second, 'use warnings;', 'second not empty line is "use warnings;"';
+}
+
+sub files {
+    use File::Find;
+    my @res;
+    find(
+        sub { push @res, $File::Find::name if -f && $_ eq 'content' },
+        'etc/upgrade/'
+    );
+    return @res;
+}
\ No newline at end of file

commit b584fc040150b676d3f7f43955264d789310e17a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 04:39:10 2011 +0400

    use strict and warnings in ever upgrade/*/content
    
    use 'our' to declare arrays

diff --git a/etc/upgrade/3.1.15/content b/etc/upgrade/3.1.15/content
index d23125a..9e4b253 100644
--- a/etc/upgrade/3.1.15/content
+++ b/etc/upgrade/3.1.15/content
@@ -1,4 +1,7 @@
- at Scrips = (
+use strict;
+use warnings;
+
+our @Scrips = (
     {  ScripCondition => 'On Owner Change',
        ScripAction    => 'Notify Owner',
        Template       => 'Transaction' },
diff --git a/etc/upgrade/3.1.17/content b/etc/upgrade/3.1.17/content
index 1d648d8..a6b5c54 100644
--- a/etc/upgrade/3.1.17/content
+++ b/etc/upgrade/3.1.17/content
@@ -1,4 +1,7 @@
- at ScripActions = (
+use strict;
+use warnings;
+
+our @ScripActions = (
     { Name        => 'Notify Ccs as Comment',              # loc
       Description => 'Sends mail to the Ccs as a comment', # loc
       ExecModule  => 'NotifyAsComment',
@@ -10,7 +13,7 @@
 );
 
 
- at ScripConditions = (
+our @ScripConditions = (
     {
       Name                 => 'On Priority Change',                       # loc
       Description          => 'Whenever a ticket\'s priority changes',    # loc
diff --git a/etc/upgrade/3.5.1/content b/etc/upgrade/3.5.1/content
index 02d6a0c..a125074 100644
--- a/etc/upgrade/3.5.1/content
+++ b/etc/upgrade/3.5.1/content
@@ -1,4 +1,7 @@
- at Attributes = (
+use strict;
+use warnings;
+
+our @Attributes = (
     { Name => 'Search - My Tickets',
       Description => '[_1] highest priority tickets I own',
       Content     =>
diff --git a/etc/upgrade/3.7.1/content b/etc/upgrade/3.7.1/content
index fdd5061..e39ef8a 100644
--- a/etc/upgrade/3.7.1/content
+++ b/etc/upgrade/3.7.1/content
@@ -1,4 +1,7 @@
- at ScripConditions = (
+use strict;
+use warnings;
+
+our @ScripConditions = (
     {  Name                 => 'On Close',                                 # loc
        Description          => 'Whenever a ticket is closed', # loc
        ApplicableTransTypes => 'Status,Set',
diff --git a/etc/upgrade/3.7.10/content b/etc/upgrade/3.7.10/content
index d19f9e6..fd4628d 100644
--- a/etc/upgrade/3.7.10/content
+++ b/etc/upgrade/3.7.10/content
@@ -1,5 +1,8 @@
+use strict;
+use warnings;
 
- at Templates = (
+
+our @Templates = (
     {  Queue       => 0,
        Name        => "Error: public key",    # loc
        Description =>
diff --git a/etc/upgrade/3.7.15/content b/etc/upgrade/3.7.15/content
index 9d97c35..a3a27fd 100644
--- a/etc/upgrade/3.7.15/content
+++ b/etc/upgrade/3.7.15/content
@@ -1,5 +1,8 @@
+use strict;
+use warnings;
 
- at Templates = (
+
+our @Templates = (
     {  Queue       => 0,
        Name        => "Forward",    # loc
        Description => "Heading of a forwarded message", # loc
diff --git a/etc/upgrade/3.7.19/content b/etc/upgrade/3.7.19/content
index e529b82..a7b2539 100644
--- a/etc/upgrade/3.7.19/content
+++ b/etc/upgrade/3.7.19/content
@@ -1,4 +1,7 @@
- at Final = (
+use strict;
+use warnings;
+
+our @Final = (
     sub {
         require RT::Scrips;
         my $scrips = RT::Scrips->new( RT->SystemUser );
diff --git a/etc/upgrade/3.7.82/content b/etc/upgrade/3.7.82/content
index a1c555f..da406c4 100644
--- a/etc/upgrade/3.7.82/content
+++ b/etc/upgrade/3.7.82/content
@@ -1,4 +1,7 @@
- at Attributes = (
+use strict;
+use warnings;
+
+our @Attributes = (
     { Name => 'Search - Bookmarked Tickets',
       Description => 'Bookmarked Tickets', #loc
       Content     =>
diff --git a/etc/upgrade/3.7.85/content b/etc/upgrade/3.7.85/content
index 49ab286..8f9a824 100644
--- a/etc/upgrade/3.7.85/content
+++ b/etc/upgrade/3.7.85/content
@@ -1,4 +1,7 @@
- at Templates = ( 
+use strict;
+use warnings;
+
+our @Templates = ( 
 	       
 	       {   Queue       => '0',
 		   Name        => 'Email Digest',    # loc
diff --git a/etc/upgrade/3.7.86/content b/etc/upgrade/3.7.86/content
index 94912d6..56e69ae 100644
--- a/etc/upgrade/3.7.86/content
+++ b/etc/upgrade/3.7.86/content
@@ -1,4 +1,7 @@
- at Final = (
+use strict;
+use warnings;
+
+our @Final = (
     sub {
         $RT::Logger->debug("Adding search for bookmarked tickets to defaults");
         my $sys = RT::System->new(RT->SystemUser);
diff --git a/etc/upgrade/3.7.87/content b/etc/upgrade/3.7.87/content
index 0c677c4..c67feb4 100644
--- a/etc/upgrade/3.7.87/content
+++ b/etc/upgrade/3.7.87/content
@@ -1,4 +1,7 @@
- at Templates = (
+use strict;
+use warnings;
+
+our @Templates = (
 {
     Queue       => 0,
     Name        => "Error: Missing dashboard",    # loc
diff --git a/etc/upgrade/3.8.0/content b/etc/upgrade/3.8.0/content
index 4fa5ac7..89219a0 100644
--- a/etc/upgrade/3.8.0/content
+++ b/etc/upgrade/3.8.0/content
@@ -1,4 +1,7 @@
- at Final = (
+use strict;
+use warnings;
+
+our @Final = (
     # by incident we've changed 'My Bookmarks' to 'Bookmarked Tickets' when
     # 3.7.82 upgrade script still was creating 'My Bookmarks', try to fix it
     sub {
diff --git a/etc/upgrade/3.8.1/content b/etc/upgrade/3.8.1/content
index 1667efa..ed52a31 100644
--- a/etc/upgrade/3.8.1/content
+++ b/etc/upgrade/3.8.1/content
@@ -1,4 +1,7 @@
- at Final = (
+use strict;
+use warnings;
+
+our @Final = (
     sub {
         $RT::Logger->debug("Going to adjust 'Bookmarked Tickets'");
         my $sys = RT::System->new(RT->SystemUser);
diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 0eef401..5ab28d8 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -1,4 +1,7 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
         $RT::Logger->warning(
             "Going to add [OLD] prefix to all templates in approvals queue."
@@ -25,13 +28,13 @@
         return 1;
     },
 );
- at ACL = (
+our @ACL = (
     { GroupDomain => 'SystemInternal',
       GroupType => 'privileged',
       Right  => 'ShowApprovalsTab', },
 );
 
- at Templates = (
+our @Templates = (
     {  Queue       => '___Approvals',
        Name        => "New Pending Approval",    # loc
        Description =>
@@ -106,7 +109,7 @@ The ticket has been approved, you may now start to act on it.
     },
 );
 
- at Final = (
+our @Final = (
     sub {
         $RT::Logger->debug("Going to adjust dashboards");
         my $sys = RT::System->new(RT->SystemUser);
diff --git a/etc/upgrade/3.8.3/content b/etc/upgrade/3.8.3/content
index b8052ac..bb6af54 100644
--- a/etc/upgrade/3.8.3/content
+++ b/etc/upgrade/3.8.3/content
@@ -1,4 +1,7 @@
- at ScripConditions = (
+use strict;
+use warnings;
+
+our @ScripConditions = (
     {  Name                 => 'On Reject',                                # loc
        Description          => 'Whenever a ticket is rejected',            # loc
        ApplicableTransTypes => 'Status',
@@ -8,7 +11,7 @@
     },
 );
 
- at Final = (
+our @Final = (
     sub {
         $RT::Logger->debug("Going to correct descriptions of notify actions in the DB");
 
diff --git a/etc/upgrade/3.8.4/content b/etc/upgrade/3.8.4/content
index 38d5514..51a316c 100644
--- a/etc/upgrade/3.8.4/content
+++ b/etc/upgrade/3.8.4/content
@@ -1,8 +1,10 @@
+use strict;
+use warnings;
 
- at Final = (
+
+our @Final = (
     sub {
         $RT::Logger->debug("Going to correct arguments of NotifyGroup actions if you have any");
-        use strict;
 
         my $actions = RT::ScripActions->new( RT->SystemUser );
         $actions->Limit(
diff --git a/etc/upgrade/3.8.6/content b/etc/upgrade/3.8.6/content
index a9793c6..3651a66 100644
--- a/etc/upgrade/3.8.6/content
+++ b/etc/upgrade/3.8.6/content
@@ -1,4 +1,7 @@
- at Templates = (
+use strict;
+use warnings;
+
+our @Templates = (
     {  Queue       => 0,
        Name        => "Forward Ticket",    # loc
        Description => "Heading of a forwarded Ticket", # loc
diff --git a/etc/upgrade/3.8.8/content b/etc/upgrade/3.8.8/content
index cad77e9..2387e9b 100644
--- a/etc/upgrade/3.8.8/content
+++ b/etc/upgrade/3.8.8/content
@@ -1,4 +1,7 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
         # make sure global CFs are not applied to local objects
         my $ocfs = RT::ObjectCustomFields->new( RT->SystemUser );
diff --git a/etc/upgrade/3.8.9/content b/etc/upgrade/3.8.9/content
index 898c19e..c1998a0 100644
--- a/etc/upgrade/3.8.9/content
+++ b/etc/upgrade/3.8.9/content
@@ -1,6 +1,8 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
-        use strict;
         $RT::Logger->debug('Make sure local links are local');
 
         use RT::URI::fsck_com_rt;
diff --git a/etc/upgrade/3.9.1/content b/etc/upgrade/3.9.1/content
index e0f4a9a..954e38e 100644
--- a/etc/upgrade/3.9.1/content
+++ b/etc/upgrade/3.9.1/content
@@ -1,6 +1,8 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
-        use strict;
         $RT::Logger->debug('Make sure templates all have known types');
 
         my $templates = RT::Templates->new(RT->SystemUser);
@@ -29,7 +31,6 @@
         }
     },
     sub {
-        use strict;
         $RT::Logger->debug('Adding ExecuteCode right to principals that currently have ModifyTemplate or ModifyScrips');
 
         my $acl = RT::ACL->new(RT->SystemUser);
diff --git a/etc/upgrade/3.9.2/content b/etc/upgrade/3.9.2/content
index d0dbbfd..22e740a 100644
--- a/etc/upgrade/3.9.2/content
+++ b/etc/upgrade/3.9.2/content
@@ -1,6 +1,8 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
-        use strict;
         $RT::Logger->debug('Removing all delegated rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index 504ddf1..fc489c3 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -1,3 +1,6 @@
+use strict;
+use warnings;
+
 my $move_attributes = sub {
     my ($table, $type, $column) = @_;
     my $query = "UPDATE $table SET $column = (SELECT Content FROM Attributes WHERE"
@@ -18,7 +21,7 @@ my $move_attributes = sub {
     return 1;
 };
 
- at Initial = (
+our @Initial = (
     sub {
         return $move_attributes->( 'Users', 'RT::User', 'AuthToken');
     },
diff --git a/etc/upgrade/3.9.8/content b/etc/upgrade/3.9.8/content
index d759db9..f5d46fa 100644
--- a/etc/upgrade/3.9.8/content
+++ b/etc/upgrade/3.9.8/content
@@ -1,4 +1,7 @@
- at Initial = sub {
+use strict;
+use warnings;
+
+our @Initial = sub {
     my $dbh = $RT::Handle->dbh;
     my $sth = $dbh->table_info( '', undef, undef, "'TABLE'");
     my $found_fm_tables = {};
diff --git a/etc/upgrade/4.0.0rc7/content b/etc/upgrade/4.0.0rc7/content
index d0d210b..deb351e 100644
--- a/etc/upgrade/4.0.0rc7/content
+++ b/etc/upgrade/4.0.0rc7/content
@@ -1,4 +1,7 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
         $RT::Logger->debug("Going to set lifecycle for approvals");
 
diff --git a/etc/upgrade/4.0.1/content b/etc/upgrade/4.0.1/content
index 9b74ff1..46b507d 100644
--- a/etc/upgrade/4.0.1/content
+++ b/etc/upgrade/4.0.1/content
@@ -1,6 +1,8 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
-        use strict;
         $RT::Logger->debug('Removing all delegated rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
@@ -44,7 +46,6 @@
         }
     },
     sub {
-        use strict;
         $RT::Logger->debug('Removing all Delegate and PersonalGroup rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
@@ -62,7 +63,6 @@
         }
     },
     sub {
-        use strict;
         $RT::Logger->debug('Removing unimplemented RejectTicket and ModifyTicketStatus rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
diff --git a/etc/upgrade/4.1.0/content b/etc/upgrade/4.1.0/content
index 80783eb..47a3c7a 100644
--- a/etc/upgrade/4.1.0/content
+++ b/etc/upgrade/4.1.0/content
@@ -1,4 +1,7 @@
- at Initial = (
+use strict;
+use warnings;
+
+our @Initial = (
     sub {
         my $users = RT::Users->new(RT->SystemUser);
         $users->UnLimit;

commit f1503503bfe021e27967587d5c105f6bb4ecbf93
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 04:44:33 2011 +0400

    avoid used only once warnings
    
    turn $RT::Logger and $RT::Handle into calls

diff --git a/etc/upgrade/3.7.86/content b/etc/upgrade/3.7.86/content
index 56e69ae..029939d 100644
--- a/etc/upgrade/3.7.86/content
+++ b/etc/upgrade/3.7.86/content
@@ -3,14 +3,14 @@ use warnings;
 
 our @Final = (
     sub {
-        $RT::Logger->debug("Adding search for bookmarked tickets to defaults");
+        RT->Logger->debug("Adding search for bookmarked tickets to defaults");
         my $sys = RT::System->new(RT->SystemUser);
 
         my $attrs = RT::Attributes->new( RT->SystemUser );
         $attrs->LimitToObject( $sys );
         my ($attr) = $attrs->Named( 'HomepageSettings' );
         unless ($attr) {
-            $RT::Logger->error("You have no global home page settings");
+            RT->Logger->error("You have no global home page settings");
             return;
         }
         my $content = $attr->Content;
@@ -18,9 +18,9 @@ our @Final = (
             { type => 'system', name => 'Bookmarked Tickets' };
 
         my ($status, $msg) = $attr->SetContent( $content );
-        $RT::Logger->error($msg) unless $status;
+        RT->Logger->error($msg) unless $status;
 
-        $RT::Logger->debug("done.");
+        RT->Logger->debug("done.");
         return 1;
     },
 );
diff --git a/etc/upgrade/3.8.0/content b/etc/upgrade/3.8.0/content
index 89219a0..ae3a9fc 100644
--- a/etc/upgrade/3.8.0/content
+++ b/etc/upgrade/3.8.0/content
@@ -5,20 +5,20 @@ our @Final = (
     # by incident we've changed 'My Bookmarks' to 'Bookmarked Tickets' when
     # 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'");
+        RT->Logger->debug("Going to rename 'My Bookmarks' to 'Bookmarked Tickets'");
         my $sys = RT::System->new(RT->SystemUser);
 
         my $attrs = RT::Attributes->new( RT->SystemUser );
         $attrs->LimitToObject( $sys );
         my ($attr) = $attrs->Named( 'Search - My Bookmarks' );
         unless ($attr) {
-            $RT::Logger->debug("You have no global search 'My Bookmarks'. Skipped.");
+            RT->Logger->debug("You have no global search 'My Bookmarks'. Skipped.");
             return 1;
         }
         my ($status, $msg) = $attr->SetName( 'Search - Bookmarked Tickets' );
-        $RT::Logger->error($msg) and return undef unless $status;
+        RT->Logger->error($msg) and return undef unless $status;
 
-        $RT::Logger->debug("Renamed.");
+        RT->Logger->debug("Renamed.");
         return 1;
     },
 );
diff --git a/etc/upgrade/3.8.1/content b/etc/upgrade/3.8.1/content
index ed52a31..08c6430 100644
--- a/etc/upgrade/3.8.1/content
+++ b/etc/upgrade/3.8.1/content
@@ -3,23 +3,23 @@ use warnings;
 
 our @Final = (
     sub {
-        $RT::Logger->debug("Going to adjust 'Bookmarked Tickets'");
+        RT->Logger->debug("Going to adjust 'Bookmarked Tickets'");
         my $sys = RT::System->new(RT->SystemUser);
 
         my $attrs = RT::Attributes->new( RT->SystemUser );
         $attrs->LimitToObject( $sys );
         my ($attr) = $attrs->Named( 'Search - Bookmarked Tickets' );
         unless ($attr) {
-            $RT::Logger->debug("You have no global search 'Bookmarked Tickets'. Skipped.");
+            RT->Logger->debug("You have no global search 'Bookmarked Tickets'. Skipped.");
             return 1;
         }
         my $props = $attr->Content;
         $props->{'Query'} =~ s/__Bookmarks__/id = '__Bookmarked__'/g;
 
         my ($status, $msg) = $attr->SetContent( $props );
-        $RT::Logger->error($msg) and return undef unless $status;
+        RT->Logger->error($msg) and return undef unless $status;
 
-        $RT::Logger->debug("Fixed.");
+        RT->Logger->debug("Fixed.");
         return 1;
     },
 );
diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 5ab28d8..4703ab7 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -3,7 +3,7 @@ use warnings;
 
 our @Initial = (
     sub {
-        $RT::Logger->warning(
+        RT->Logger->warning(
             "Going to add [OLD] prefix to all templates in approvals queue."
             ." If you have never used approvals, you can safely delete all the"
             ." templates with the [OLD] prefix. Leave the new Approval templates because"
@@ -13,7 +13,7 @@ our @Initial = (
         my $approvals_q = RT::Queue->new( RT->SystemUser );
         $approvals_q->Load('___Approvals');
         unless ( $approvals_q->id ) {
-            $RT::Logger->error("You have no approvals queue.");
+            RT->Logger->error("You have no approvals queue.");
             return 1;
         }
 
@@ -22,7 +22,7 @@ our @Initial = (
         while ( my $tmpl = $templates->Next ) {
             my ($status, $msg) = $tmpl->SetName( "[OLD] ". $tmpl->Name );
             unless ( $status ) {
-                $RT::Logger->error("Couldn't rename template #". $tmpl->id .": $msg");
+                RT->Logger->error("Couldn't rename template #". $tmpl->id .": $msg");
             }
         }
         return 1;
@@ -111,7 +111,7 @@ The ticket has been approved, you may now start to act on it.
 
 our @Final = (
     sub {
-        $RT::Logger->debug("Going to adjust dashboards");
+        RT->Logger->debug("Going to adjust dashboards");
         my $sys = RT::System->new(RT->SystemUser);
 
         my $attrs = RT::Attributes->new( RT->SystemUser );
@@ -119,7 +119,7 @@ our @Final = (
         my @dashboards = $attrs->Named('Dashboard');
 
         if (@dashboards == 0) {
-            $RT::Logger->debug("You have no dashboards. Skipped.");
+            RT->Logger->debug("You have no dashboards. Skipped.");
             return 1;
         }
 
@@ -143,28 +143,28 @@ our @Final = (
                 };
             }
             my ($status, $msg) = $attr->SetContent( $props );
-            $RT::Logger->error($msg) unless $status;
+            RT->Logger->error($msg) unless $status;
         }
 
-        $RT::Logger->debug("Fixed.");
+        RT->Logger->debug("Fixed.");
         return 1;
     },
     sub {
         my $approvals_q = RT::Queue->new( RT->SystemUser );
         $approvals_q->Load('___Approvals');
         unless ( $approvals_q->id ) {
-            $RT::Logger->error("You have no approvals queue.");
+            RT->Logger->error("You have no approvals queue.");
             return 1;
         }
 
         require File::Temp;
         my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( 'rt-approvals-scrips-XXXX', CLEANUP => 0 );
         unless ( $tmp_fh ) {
-            $RT::Logger->error("Couldn't create temporary file.");
+            RT->Logger->error("Couldn't create temporary file.");
             return 0;
         }
 
-        $RT::Logger->warning(
+        RT->Logger->warning(
             "IMPORTANT: We're going to delete all scrips in Approvals queue"
             ." and save them in '$tmp_fn' file."
         );
@@ -182,7 +182,7 @@ our @Final = (
 
             my ($status, $msg) = $scrip->Delete;
             unless ( $status ) {
-                $RT::Logger->error( "Couldn't delete scrip: $msg");
+                RT->Logger->error( "Couldn't delete scrip: $msg");
             }
         }
     },
diff --git a/etc/upgrade/3.8.3/content b/etc/upgrade/3.8.3/content
index bb6af54..38e2aeb 100644
--- a/etc/upgrade/3.8.3/content
+++ b/etc/upgrade/3.8.3/content
@@ -13,7 +13,7 @@ our @ScripConditions = (
 
 our @Final = (
     sub {
-        $RT::Logger->debug("Going to correct descriptions of notify actions in the DB");
+        RT->Logger->debug("Going to correct descriptions of notify actions in the DB");
 
         my $actions = RT::ScripActions->new( RT->SystemUser );
         $actions->Limit(
@@ -26,11 +26,11 @@ our @Final = (
         );
         while ( my $action = $actions->Next ) {
             my ($status, $msg) = $action->__Set( Field => 'Name', Value => 'Notify Owner, Requestors, Ccs and AdminCcs' );
-            $RT::Logger->warning( "Couldn't change action name: $msg" )
+            RT->Logger->warning( "Couldn't change action name: $msg" )
                 unless $status;
 
             ($status, $msg) = $action->__Set( Field => 'Description', Value => 'Send mail to owner and all watchers' );
-            $RT::Logger->warning( "Couldn't change action description: $msg" )
+            RT->Logger->warning( "Couldn't change action description: $msg" )
                 unless $status;
         }
 
@@ -45,22 +45,22 @@ our @Final = (
         );
         while ( my $action = $actions->Next ) {
             my ($status, $msg) = $action->__Set( Field => 'Name', Value => 'Notify Owner, Requestors, Ccs and AdminCcs as Comment' );
-            $RT::Logger->warning( "Couldn't change action name: $msg" )
+            RT->Logger->warning( "Couldn't change action name: $msg" )
                 unless $status;
 
             ($status, $msg) = $action->__Set( Field => 'Description', Value => 'Send mail to owner and all watchers as a "comment"' );
-            $RT::Logger->warning( "Couldn't change action description: $msg" )
+            RT->Logger->warning( "Couldn't change action description: $msg" )
                 unless $status;
         }
 
-        $RT::Logger->debug("Corrected descriptions of notify actions in the DB.");
+        RT->Logger->debug("Corrected descriptions of notify actions in the DB.");
         return 1;
     },
 );
 
 
 {
-$RT::Logger->debug("Going to add in Extract Subject Tag actions if they were missed during a previous upgrade");
+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->Limit(
@@ -70,10 +70,10 @@ $actions->Limit(
 my $extract_action = $actions->First;
 
 if ( $extract_action && $extract_action->Id ) {
-    $RT::Logger->debug("You appear to already have an Extract Subject Tag action, skipping");
+    RT->Logger->debug("You appear to already have an Extract Subject Tag action, skipping");
     return 1;
 } else {
-    $RT::Logger->debug("Didn't find an existing Extract Subject Tag action, adding it");
+    RT->Logger->debug("Didn't find an existing Extract Subject Tag action, adding it");
     push @ScripActions, (
             { Name        => 'Extract Subject Tag',                               # loc
               Description => 'Extract tags from a Transaction\'s subject and add them to the Ticket\'s subject.', # loc
@@ -81,7 +81,7 @@ if ( $extract_action && $extract_action->Id ) {
             },
     );
 
-    $RT::Logger->debug("Adding Extract Subject Tag Scrip");
+    RT->Logger->debug("Adding Extract Subject Tag Scrip");
     push @Scrips, (
         {  Description    => "On transaction, add any tags in the transaction's subject to the ticket's subject",
            ScripCondition => 'On Transaction',
diff --git a/etc/upgrade/3.8.4/content b/etc/upgrade/3.8.4/content
index 51a316c..352b008 100644
--- a/etc/upgrade/3.8.4/content
+++ b/etc/upgrade/3.8.4/content
@@ -4,7 +4,7 @@ use warnings;
 
 our @Final = (
     sub {
-        $RT::Logger->debug("Going to correct arguments of NotifyGroup actions if you have any");
+        RT->Logger->debug("Going to correct arguments of NotifyGroup actions if you have any");
 
         my $actions = RT::ScripActions->new( RT->SystemUser );
         $actions->Limit(
@@ -52,7 +52,7 @@ our @Final = (
             next if $new eq $argument;
 
             my ($status, $msg) = $action->__Set( Field => 'Argument', Value => $new );
-            $RT::Logger->warning( "Couldn't change argument value of the action: $msg" )
+            RT->Logger->warning( "Couldn't change argument value of the action: $msg" )
                 unless $status;
         }
     },
diff --git a/etc/upgrade/3.8.8/content b/etc/upgrade/3.8.8/content
index 2387e9b..50b3314 100644
--- a/etc/upgrade/3.8.8/content
+++ b/etc/upgrade/3.8.8/content
@@ -18,7 +18,7 @@ our @Initial = (
     },
     sub {
         # sort SortOrder
-        my $sth = $RT::Handle->dbh->prepare(
+        my $sth = RT->DatabaseHandle->dbh->prepare(
             "SELECT cfs.LookupType, ocfs.id"
             ." FROM ObjectCustomFields ocfs, CustomFields cfs"
             ." WHERE cfs.id = ocfs.CustomField"
@@ -32,7 +32,7 @@ our @Initial = (
             my $ocf = RT::ObjectCustomField->new( RT->SystemUser );
             $ocf->Load( $id );
             my ($status, $msg) = $ocf->SetSortOrder( $i++ );
-            $RT::Logger->warning("Couldn't set SortOrder: $msg")
+            RT->Logger->warning("Couldn't set SortOrder: $msg")
                 unless $status;
             $prev_type = $lt;
         }
diff --git a/etc/upgrade/3.8.9/content b/etc/upgrade/3.8.9/content
index c1998a0..cfd41c8 100644
--- a/etc/upgrade/3.8.9/content
+++ b/etc/upgrade/3.8.9/content
@@ -3,7 +3,7 @@ use warnings;
 
 our @Initial = (
     sub {
-        $RT::Logger->debug('Make sure local links are local');
+        RT->Logger->debug('Make sure local links are local');
 
         use RT::URI::fsck_com_rt;
         my $prefix = RT::URI::fsck_com_rt->LocalURIPrefix . '/ticket/';
diff --git a/etc/upgrade/3.9.1/content b/etc/upgrade/3.9.1/content
index 954e38e..1c11083 100644
--- a/etc/upgrade/3.9.1/content
+++ b/etc/upgrade/3.9.1/content
@@ -3,7 +3,7 @@ use warnings;
 
 our @Initial = (
     sub {
-        $RT::Logger->debug('Make sure templates all have known types');
+        RT->Logger->debug('Make sure templates all have known types');
 
         my $templates = RT::Templates->new(RT->SystemUser);
         $templates->Limit(
@@ -27,11 +27,11 @@ our @Initial = (
         $templates->UnLimit();
         while (my $template = $templates->Next) {
             my ($status, $msg) = $template->SetType('Perl');
-            $RT::Logger->warning( "Couldn't change Type of Template #" . $template->Id . ": $msg" ) unless $status;
+            RT->Logger->warning( "Couldn't change Type of Template #" . $template->Id . ": $msg" ) unless $status;
         }
     },
     sub {
-        $RT::Logger->debug('Adding ExecuteCode right to principals that currently have ModifyTemplate or ModifyScrips');
+        RT->Logger->debug('Adding ExecuteCode right to principals that currently have ModifyTemplate or ModifyScrips');
 
         my $acl = RT::ACL->new(RT->SystemUser);
         $acl->Limit(
@@ -60,7 +60,7 @@ our @Initial = (
             );
 
             if (!$ok) {
-                $RT::Logger->warn("Unable to grant ExecuteCode on principal " . $principal->id . ": $msg");
+                RT->Logger->warn("Unable to grant ExecuteCode on principal " . $principal->id . ": $msg");
             }
         }
     },
diff --git a/etc/upgrade/3.9.2/content b/etc/upgrade/3.9.2/content
index 22e740a..27c91a7 100644
--- a/etc/upgrade/3.9.2/content
+++ b/etc/upgrade/3.9.2/content
@@ -3,7 +3,7 @@ use warnings;
 
 our @Initial = (
     sub {
-        $RT::Logger->debug('Removing all delegated rights');
+        RT->Logger->debug('Removing all delegated rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
         $acl->Limit( CLAUSE   => 'search',
@@ -22,7 +22,7 @@ our @Initial = (
             my ( $ok, $msg ) = $ace->Delete();
 
             if ( !$ok ) {
-                $RT::Logger->warn(
+                RT->Logger->warn(
                            "Unable to delete ACE " . $ace->id . ": " . $msg );
             }
         }
@@ -37,7 +37,7 @@ our @Initial = (
             while ( my $member = $members->Next ) {
                 my ( $ok, $msg ) = $group->DeleteMember( $member->MemberId );
                 if ( !$ok ) {
-                    $RT::Logger->warn(   "Unable to remove group member "
+                    RT->Logger->warn(   "Unable to remove group member "
                                        . $member->id . ": "
                                        . $msg );
                 }
diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index fc489c3..a2b1d7f 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -6,16 +6,16 @@ my $move_attributes = sub {
     my $query = "UPDATE $table SET $column = (SELECT Content FROM Attributes WHERE"
         ." Name = ? AND ObjectType = ? AND $table.id = Attributes.ObjectId)";
 
-    my $res = $RT::Handle->SimpleQuery( $query, $column, $type );
+    my $res = RT->DatabaseHandle->SimpleQuery( $query, $column, $type );
     unless ( $res ) {
-        $RT::Logger->error("Failed to move $column on $type from Attributes into $table table");
+        RT->Logger->error("Failed to move $column on $type from Attributes into $table table");
         return;
     }
 
     $query = 'DELETE FROM Attributes WHERE Name = ? AND ObjectType = ?';
-    $res = $RT::Handle->SimpleQuery( $query, $column, $type );
+    $res = RT->DatabaseHandle->SimpleQuery( $query, $column, $type );
     unless ( $res ) {
-        $RT::Logger->error("Failed to delete $column on $type from Attributes");
+        RT->Logger->error("Failed to delete $column on $type from Attributes");
         return;
     }
     return 1;
@@ -43,9 +43,9 @@ our @Initial = (
             $cf->SetBasedOn($attr->Content);
         }
         $query = 'DELETE FROM Attributes WHERE Name = ? AND ObjectType = ?';
-        $res = $RT::Handle->SimpleQuery( $query, 'BasedOn', 'RT::CustomField' );
+        $res = RT->DatabaseHandle->SimpleQuery( $query, 'BasedOn', 'RT::CustomField' );
         unless ( $res ) {
-            $RT::Logger->error("Failed to delete BasedOn CustomFields from Attributes");
+            RT->Logger->error("Failed to delete BasedOn CustomFields from Attributes");
             return;
         }
         return 1;
@@ -55,9 +55,9 @@ our @Initial = (
             or return;
 
         my $query = "UPDATE CustomFields SET ValuesClass = NULL WHERE ValuesClass = ?";
-        my $res = $RT::Handle->SimpleQuery( $query, 'RT::CustomFieldValues' );
+        my $res = RT->DatabaseHandle->SimpleQuery( $query, 'RT::CustomFieldValues' );
         unless ( $res ) {
-            $RT::Logger->error("Failed to replace default with NULLs");
+            RT->Logger->error("Failed to replace default with NULLs");
             return;
         }
         return 1;
@@ -71,13 +71,13 @@ our @Initial = (
             my $queue = RT::Queue->new( RT->SystemUser );
             $queue->Load( $qid );
             unless ( $queue->id ) {
-                $RT::Logger->warning("Couldn't load queue #$qid. Skipping...");
+                RT->Logger->warning("Couldn't load queue #$qid. Skipping...");
                 next;
             }
 
             my ($status, $msg) = $queue->SetSubjectTag($tag);
             unless ( $status ) {
-                $RT::Logger->error("Couldn't set subject tag for queue #$qid: $msg");
+                RT->Logger->error("Couldn't set subject tag for queue #$qid: $msg");
                 next;
             }
         }
diff --git a/etc/upgrade/3.9.8/content b/etc/upgrade/3.9.8/content
index f5d46fa..40c2c0a 100644
--- a/etc/upgrade/3.9.8/content
+++ b/etc/upgrade/3.9.8/content
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 
 our @Initial = sub {
-    my $dbh = $RT::Handle->dbh;
+    my $dbh = RT->DatabaseHandle->dbh;
     my $sth = $dbh->table_info( '', undef, undef, "'TABLE'");
     my $found_fm_tables = {};
     while ( my $table = $sth->fetchrow_hashref ) {
@@ -14,14 +14,14 @@ our @Initial = sub {
     return unless %$found_fm_tables;
 
     unless ( $found_fm_tables->{fm_topics} && $found_fm_tables->{fm_objecttopics} ) {
-        $RT::Logger->error("You appear to be upgrading from RTFM 2.0 - We don't support upgrading this old of an RTFM yet");
+        RT->Logger->error("You appear to be upgrading from RTFM 2.0 - We don't support upgrading this old of an RTFM yet");
     }
 
-    $RT::Logger->error("We found RTFM tables in your database.  Checking for content.");
+    RT->Logger->error("We found RTFM tables in your database.  Checking for content.");
 
     my $result = $dbh->selectall_arrayref("SELECT count(*) AS articlecount FROM FM_Articles", { Slice => {} } );
 
     if ($result->[0]{articlecount} > 0) {
-        $RT::Logger->error("You appear to have RTFM Articles.  You can upgrade using the etc/upgrade/upgrade-articles script.  Read more about it in UPGRADING");
+        RT->Logger->error("You appear to have RTFM Articles.  You can upgrade using the etc/upgrade/upgrade-articles script.  Read more about it in UPGRADING");
     }
 };
diff --git a/etc/upgrade/4.0.0rc7/content b/etc/upgrade/4.0.0rc7/content
index deb351e..7b9e9c1 100644
--- a/etc/upgrade/4.0.0rc7/content
+++ b/etc/upgrade/4.0.0rc7/content
@@ -3,12 +3,12 @@ use warnings;
 
 our @Initial = (
     sub {
-        $RT::Logger->debug("Going to set lifecycle for approvals");
+        RT->Logger->debug("Going to set lifecycle for approvals");
 
         my $queue = RT::Queue->new( RT->SystemUser );
         $queue->Load('___Approvals');
         unless ( $queue->id ) {
-            $RT::Logger->warning("There is no ___Approvals queue in the DB");
+            RT->Logger->warning("There is no ___Approvals queue in the DB");
             return 1;
         }
 
@@ -16,7 +16,7 @@ our @Initial = (
 
         my ($status, $msg) = $queue->SetLifecycle('approvals');
         unless ( $status ) {
-            $RT::Logger->error("Couldn't set lifecycle for '___Approvals' queue: $msg");
+            RT->Logger->error("Couldn't set lifecycle for '___Approvals' queue: $msg");
             return 0;
         }
         return 1;
diff --git a/etc/upgrade/4.0.1/content b/etc/upgrade/4.0.1/content
index 46b507d..14da329 100644
--- a/etc/upgrade/4.0.1/content
+++ b/etc/upgrade/4.0.1/content
@@ -3,7 +3,7 @@ use warnings;
 
 our @Initial = (
     sub {
-        $RT::Logger->debug('Removing all delegated rights');
+        RT->Logger->debug('Removing all delegated rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
         my $groupjoin = $acl->NewAlias('Groups');
@@ -22,7 +22,7 @@ our @Initial = (
             my ( $ok, $msg ) = $ace->Delete();
 
             if ( !$ok ) {
-                $RT::Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
+                RT->Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
             }
         }
 
@@ -36,7 +36,7 @@ our @Initial = (
             while ( my $member = $members->Next ) {
                 my ( $ok, $msg ) = $group->DeleteMember( $member->MemberId );
                 if ( !$ok ) {
-                    $RT::Logger->warn(   "Unable to remove group member "
+                    RT->Logger->warn(   "Unable to remove group member "
                                        . $member->id . ": "
                                        . $msg );
                 }
@@ -46,7 +46,7 @@ our @Initial = (
         }
     },
     sub {
-        $RT::Logger->debug('Removing all Delegate and PersonalGroup rights');
+        RT->Logger->debug('Removing all Delegate and PersonalGroup rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
         for my $right (qw/AdminOwnPersonalGroups AdminAllPersonalGroups DelegateRights/) {
@@ -55,15 +55,15 @@ our @Initial = (
 
         while ( my $ace = $acl->Next ) {
             my ( $ok, $msg ) = $ace->Delete();
-            $RT::Logger->debug("Removing ACE ".$ace->id." for right ".$ace->__Value('RightName'));
+            RT->Logger->debug("Removing ACE ".$ace->id." for right ".$ace->__Value('RightName'));
 
             if ( !$ok ) {
-                $RT::Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
+                RT->Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
             }
         }
     },
     sub {
-        $RT::Logger->debug('Removing unimplemented RejectTicket and ModifyTicketStatus rights');
+        RT->Logger->debug('Removing unimplemented RejectTicket and ModifyTicketStatus rights');
 
         my $acl = RT::ACL->new(RT->SystemUser);
         for my $right (qw/RejectTicket ModifyTicketStatus/) {
@@ -72,10 +72,10 @@ our @Initial = (
 
         while ( my $ace = $acl->Next ) {
             my ( $ok, $msg ) = $ace->Delete();
-            $RT::Logger->debug("Removing ACE ".$ace->id." for right ".$ace->__Value('RightName'));
+            RT->Logger->debug("Removing ACE ".$ace->id." for right ".$ace->__Value('RightName'));
 
             if ( !$ok ) {
-                $RT::Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
+                RT->Logger->warn( "Unable to delete ACE " . $ace->id . ": " . $msg );
             }
         }
     },

commit 12886cdacf94d0bb75c397a64cffcc3191943db3
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 04:49:23 2011 +0400

    $tmp was never defined in upgrade/3.8.2/content
    
    code never worked as expected and produced hash
    with values in keys and values

diff --git a/etc/upgrade/3.8.2/content b/etc/upgrade/3.8.2/content
index 4703ab7..0b60b51 100644
--- a/etc/upgrade/3.8.2/content
+++ b/etc/upgrade/3.8.2/content
@@ -175,7 +175,7 @@ our @Final = (
         $scrips->LimitToQueue( $approvals_q->id );
         while ( my $scrip = $scrips->Next ) {
             my %tmp =
-                map { $tmp->{ $_ } = $scrip->_Value( $_ ) }
+                map { $_ => $scrip->_Value( $_ ) }
                 $scrip->ReadableAttributes;
 
             print $tmp_fh Data::Dumper::Dumper( \%tmp );

commit a303b0fba6ea897d548b06910ec29d7e73bb3762
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 05:01:01 2011 +0400

    mark data arrays with 'our'

diff --git a/etc/upgrade/3.8.3/content b/etc/upgrade/3.8.3/content
index 38e2aeb..81d14bf 100644
--- a/etc/upgrade/3.8.3/content
+++ b/etc/upgrade/3.8.3/content
@@ -58,7 +58,7 @@ our @Final = (
     },
 );
 
-
+our (@ScripActions, @Scrips);
 {
 RT->Logger->debug("Going to add in Extract Subject Tag actions if they were missed during a previous upgrade");
 

commit 84d708dc5fff63ca3a3f7b8b92864b454966726b
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 05:02:24 2011 +0400

    mark $action with 'my'

diff --git a/etc/upgrade/3.8.3/content b/etc/upgrade/3.8.3/content
index 81d14bf..cbb385f 100644
--- a/etc/upgrade/3.8.3/content
+++ b/etc/upgrade/3.8.3/content
@@ -62,7 +62,7 @@ our (@ScripActions, @Scrips);
 {
 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 );
+my $actions = RT::ScripActions->new( RT->SystemUser );
 $actions->Limit(
     FIELD => 'ExecModule',
     VALUE => 'ExtractSubjectTag',

commit 9bac0cf2b4f552ce47d24ef6ee94ab249909bae5
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 05:05:41 2011 +0400

    join takes a string, not a regexp
    
    use warnings++

diff --git a/etc/upgrade/3.8.4/content b/etc/upgrade/3.8.4/content
index 352b008..0276851 100644
--- a/etc/upgrade/3.8.4/content
+++ b/etc/upgrade/3.8.4/content
@@ -47,7 +47,7 @@ our @Final = (
             if ( my $struct = eval { Storable::thaw( $argument ) } ) {
                 $new = $converter->( $struct );
             } else {
-                $new = join /, /, grep length, split /[^0-9]+/, $argument;
+                $new = join ', ', grep length, split /[^0-9]+/, $argument;
             }
             next if $new eq $argument;
 

commit bfef61fa51c2f0cf48fbba615a18d9a2da767115
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 05:09:06 2011 +0400

    add a few 'my' into declarations

diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index a2b1d7f..bd5c040 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -42,8 +42,8 @@ our @Initial = (
             next unless $attr;
             $cf->SetBasedOn($attr->Content);
         }
-        $query = 'DELETE FROM Attributes WHERE Name = ? AND ObjectType = ?';
-        $res = RT->DatabaseHandle->SimpleQuery( $query, 'BasedOn', 'RT::CustomField' );
+        my $query = 'DELETE FROM Attributes WHERE Name = ? AND ObjectType = ?';
+        my $res = RT->DatabaseHandle->SimpleQuery( $query, 'BasedOn', 'RT::CustomField' );
         unless ( $res ) {
             RT->Logger->error("Failed to delete BasedOn CustomFields from Attributes");
             return;

commit 71864b448ea7b6a0c2aab45be6eed97e5d10393c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Aug 4 05:10:31 2011 +0400

    avoid "used only once" warning

diff --git a/etc/upgrade/3.9.7/content b/etc/upgrade/3.9.7/content
index bd5c040..9b48b4b 100644
--- a/etc/upgrade/3.9.7/content
+++ b/etc/upgrade/3.9.7/content
@@ -29,7 +29,7 @@ our @Initial = (
         return $move_attributes->( 'CustomFields', 'RT::CustomField', 'RenderType');
     },
     sub {
-        my $cfs = RT::CustomFields->new($RT::SystemUser);
+        my $cfs = RT::CustomFields->new( RT->SystemUser );
         $cfs->UnLimit;
         $cfs->FindAllRows;
         while ( my $cf = $cfs->Next ) {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list