[Rt-commit] rtir branch, 2.9-trunk, updated. 2.6.1-506-g8520377

Ruslan Zakirov ruz at bestpractical.com
Mon Oct 17 18:11:07 EDT 2011


The branch, 2.9-trunk has been updated
       via  8520377f9f0c16198ae9765b7976d68ae9e7361c (commit)
      from  4baa05f64fb2cccaace17d8ae58639f95e5e4279 (commit)

Summary of changes:
 TODO.porting_over_RT4     |    6 ------
 UPGRADING                 |    4 ++++
 etc/upgrade/2.9.0/content |   17 +++++++++++++++++
 3 files changed, 21 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 8520377f9f0c16198ae9765b7976d68ae9e7361c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Oct 18 02:07:48 2011 +0400

    upgrade format of saved searches: State->Status
    
    It may skip some cases

diff --git a/TODO.porting_over_RT4 b/TODO.porting_over_RT4
index 76a650b..db2499f 100644
--- a/TODO.porting_over_RT4
+++ b/TODO.porting_over_RT4
@@ -7,12 +7,6 @@
 
 * Review tutorials in context of lifecycles.
 
-=== UPGRADING
-
-* replace '__CustomField.{State}__/TITLE:State' with __Status__
-  in saved searches
-** document it in upgrading?
-
 === BRINGING UP TO DATE
 
 * Some pages with forms need new nice layouts like in RT, reply
diff --git a/UPGRADING b/UPGRADING
index 4dd63e2..acca023 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -91,6 +91,10 @@ Upgrading from 2.6.x and earlier
    had '__CustomField.{State}__' that is replaced with __Status__.
    You should update config if you have customizations.
 
+   Format strings of all saved searches are updated with
+   with above change, but regular expression is trvial and
+   may skip some edge cases.
+
    Read more about lifecycles in RT's and RTIR's configs.
 
 2) To keep history intact upgrade script turns changes of
diff --git a/etc/upgrade/2.9.0/content b/etc/upgrade/2.9.0/content
index e8d17d7..257229b 100644
--- a/etc/upgrade/2.9.0/content
+++ b/etc/upgrade/2.9.0/content
@@ -383,6 +383,7 @@ our @Final = (
         }
     },
 
+    # fix description of a few scrips, it doesn't match meaning
     sub {
         my $scrips = RT::Scrips->new( RT->SystemUser );
         my $alias = $scrips->Join(
@@ -404,6 +405,22 @@ our @Final = (
                 unless $status;
         }
     },
+
+    # replace State CF in format strings of saved searches with status
+    sub {
+        my $searches = RT::Attributes->new( RT->SystemUser );
+        $searches->Limit(FIELD => 'Name', VALUE => 'SavedSearch');
+        while ( my $search = $searches->Next ) {
+            my $props = $search->Content;
+            next unless $props && ref($props) eq 'HASH' && $props->{'Format'};
+
+            next unless $props->{'Format'} =~ s{'__CustomField\.{State}__(?:/TITLE:State)?'}{__Status__}g;
+
+            my ($status, $msg) = $search->SetContent( $props );
+            RT->Logger->error("Couldn't update saved search: $msg")
+                unless $status;
+        }
+    },
 );
 
 

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


More information about the Rt-commit mailing list