[Rt-commit] rt branch, 4.2/upgrade-history, updated. rt-4.0.5-299-g57b73ea

Kevin Falcone falcone at bestpractical.com
Wed Aug 15 19:07:32 EDT 2012


The branch, 4.2/upgrade-history has been updated
       via  57b73ea567d697d5d342f90e640f77842e999205 (commit)
       via  81384c5340f3ce84040719b0389038756f69c315 (commit)
      from  ac0cf0af56571f79c563e7ccd4fe6d0d3c6347cb (commit)

Summary of changes:
 lib/RT/System.pm                          | 22 +++++++++++-----------
 sbin/rt-setup-database.in                 | 20 ++++++++++----------
 share/html/Admin/Tools/Configuration.html | 12 +++++++-----
 3 files changed, 28 insertions(+), 26 deletions(-)

- Log -----------------------------------------------------------------
commit 81384c5340f3ce84040719b0389038756f69c315
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Aug 15 17:56:50 2012 -0400

    Hopefully the last variable rename from component to package

diff --git a/lib/RT/System.pm b/lib/RT/System.pm
index 409ebed..708724a 100644
--- a/lib/RT/System.pm
+++ b/lib/RT/System.pm
@@ -258,9 +258,9 @@ sub QueueCacheNeedsUpdate {
     }
 }
 
-=head2 AddUpgradeHistory realm, data
+=head2 AddUpgradeHistory package, data
 
-Adds an entry to the upgrade history database. The component can be either C<RT>
+Adds an entry to the upgrade history database. The package can be either C<RT>
 for core RT upgrades, or the fully qualified name of a plugin. The data must be
 a hash reference.
 
@@ -268,7 +268,7 @@ a hash reference.
 
 sub AddUpgradeHistory {
     my $self  = shift;
-    my $component = shift;
+    my $package = shift;
     my $data  = shift;
 
     $data->{timestamp}  ||= time;
@@ -277,7 +277,7 @@ sub AddUpgradeHistory {
     my $upgrade_history_attr = $self->FirstAttribute('UpgradeHistory');
     my $upgrade_history = $upgrade_history_attr ? $upgrade_history_attr->Content : {};
 
-    push @{ $upgrade_history->{$component} }, $data;
+    push @{ $upgrade_history->{$package} }, $data;
 
     $self->SetAttribute(
         Name    => 'UpgradeHistory',
@@ -285,23 +285,23 @@ sub AddUpgradeHistory {
     );
 }
 
-=head2 UpgradeHistory [component]
+=head2 UpgradeHistory [package]
 
-Returns the entries of RT's upgrade history. If a component is specified, the list
-of upgrades for that component will be returned. Otherwise a hash reference of
-C<< component => [upgrades] >> will be returned.
+Returns the entries of RT's upgrade history. If a package is specified, the list
+of upgrades for that package will be returned. Otherwise a hash reference of
+C<< package => [upgrades] >> will be returned.
 
 =cut
 
 sub UpgradeHistory {
     my $self  = shift;
-    my $component = shift;
+    my $package = shift;
 
     my $upgrade_history_attr = $self->FirstAttribute('UpgradeHistory');
     my $upgrade_history = $upgrade_history_attr ? $upgrade_history_attr->Content : {};
 
-    if ($component) {
-        return @{ $upgrade_history->{$component} || [] };
+    if ($package) {
+        return @{ $upgrade_history->{$package} || [] };
     }
 
     return $upgrade_history;
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 31ad3a2..e24c625 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -82,7 +82,7 @@ GetOptions(
     'force', 'debug',
     'dba=s', 'dba-password=s', 'prompt-for-dba-password',
     'datafile=s', 'datadir=s', 'skip-create', 'root-password-file=s',
-    'component=s', 'ext-version=s',
+    'package=s', 'ext-version=s',
     'help|h',
 );
 
@@ -186,7 +186,7 @@ print "Working with:\n"
     ."Type:\t$db_type\nHost:\t$db_host\nName:\t$db_name\n"
     ."User:\t$db_user\nDBA:\t$dba_user" . ($args{'skip-create'} ? ' (No DBA)' : '') . "\n";
 
-my $component = $args{'component'} || 'RT';
+my $package = $args{'package'} || 'RT';
 my $ext_version = $args{'ext-version'};
 
 foreach my $action ( @actions ) {
@@ -315,7 +315,7 @@ sub action_insert {
 
     $upgrade_data{'ext_version'} = $ext_version if $ext_version;
 
-    RT->System->AddUpgradeHistory($component => \%upgrade_data);
+    RT->System->AddUpgradeHistory($package => \%upgrade_data);
 
     my $db_type = RT->Config->Get('DatabaseType');
     $RT::Handle->Disconnect() unless $db_type eq 'SQLite';
@@ -408,7 +408,7 @@ sub action_upgrade {
     RT->InitLogging();
     RT->InitSystemObjects();
 
-    RT->System->AddUpgradeHistory($component => {
+    RT->System->AddUpgradeHistory($package => {
         type      => 'full upgrade',
         action    => 'upgrade',
         stage     => 'before',
@@ -424,7 +424,7 @@ sub action_upgrade {
         my @back = grep {-e $_} map {"$base_dir/$versions[$_]/backcompat"} $n+1..$#versions;
         print "Processing $v\n";
 
-        RT->System->AddUpgradeHistory($component => {
+        RT->System->AddUpgradeHistory($package => {
             action => 'upgrade',
             type   => 'individual upgrade',
             stage  => 'before',
@@ -452,7 +452,7 @@ sub action_upgrade {
 
 	RT->ConnectToDatabase();
 
-        RT->System->AddUpgradeHistory($component => {
+        RT->System->AddUpgradeHistory($package => {
             action => 'upgrade',
             type   => 'individual upgrade',
             stage  => 'after',
@@ -463,7 +463,7 @@ sub action_upgrade {
         $previous = $v;
     }
 
-    RT->System->AddUpgradeHistory($component => {
+    RT->System->AddUpgradeHistory($package => {
         type      => 'full upgrade',
         action    => 'upgrade',
         stage     => 'after',
@@ -657,11 +657,11 @@ administrator privileges
 for 'init' and 'insert': rather than using the default administrative password
 for RT's "root" user, use the password in this file.
 
-=item component
+=item package 
 
 the name of the entity performing a create or upgrade. Used for logging changes
-in the DB. Defaults to RT, but can be the name of an extension or plugin making
-changes to the DB.
+in the DB. Defaults to RT, otherwise it should be the fully qualified package name
+of the extension or plugin making changes to the DB.
 
 =item ext-version
 
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index 94c9adf..312d58a 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -252,9 +252,9 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
 <&|/Widgets/TitleBox, title => loc("RT upgrade history")&>
 
 % my $upgrade_history = RT->System->UpgradeHistory;
-% my @realms = ('RT', sort grep { $_ ne 'RT' } keys %$upgrade_history);
-% for my $realm (@realms) {
-<h4><% $realm %></h4>
+% my @packages = ('RT', sort grep { $_ ne 'RT' } keys %$upgrade_history);
+% for my $package (@packages) {
+<h4><% $package %></h4>
 <table border="0" cellspacing="0" cellpadding="5" width="100%" class="collection">
 <tr class="collection-as-table">
 <th class="collection-as-table"><&|/l&>Action</&></th>
@@ -264,7 +264,7 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
 
 <%perl>
     my $i = 0;
-    for my $upgrade (@{ $upgrade_history->{$realm} }) {
+    for my $upgrade (@{ $upgrade_history->{$package} }) {
         # only list completed upgrades
         next unless $upgrade->{stage} eq 'after';
 </%perl>

commit 57b73ea567d697d5d342f90e640f77842e999205
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Aug 15 17:57:44 2012 -0400

    Display the upgrade time in the current user's timezone
    
    We store as UTC, but everything else in RT converts the timestamp, so do
    it here also.

diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index 312d58a..5a45420 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -280,7 +280,9 @@ if ($item =~ /^\s*(.*?)\s*v(\S+);/) {
         <% $upgrade->{rt_version} %>
     </td>
     <td class="collection-as-table">
-        <% scalar gmtime($upgrade->{timestamp}) %>
+%          my $timestamp = RT::Date->new($session{CurrentUser});
+%          $timestamp->Set(Value => $upgrade->{timestamp});
+           <% $timestamp->AsString %>
     </td>
     <td class="collection-as-table">
 % if ($upgrade->{action} eq 'upgrade') {

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


More information about the Rt-commit mailing list