[Rt-commit] rt branch, 4.0/disabled-article-cfs, created. rt-4.0.18-74-g9d60fbc

Kevin Falcone falcone at bestpractical.com
Fri Nov 22 16:10:07 EST 2013


The branch, 4.0/disabled-article-cfs has been created
        at  9d60fbcd534f0f999742db4c909fa35cb4a54c27 (commit)

- Log -----------------------------------------------------------------
commit 27cd81c4cec6dbf6b5670c4ee69b2a49a1230093
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Nov 20 17:13:58 2013 -0500

    Ensure that we also process disabled CF and OCFVs
    
    Note that ObjectCustomFieldValues takes a non-standard find_expired_rows
    option, rather than using the standard find_disabled_rows defined in
    RT::SearchBuilder
    
    Resolves #22585

diff --git a/etc/upgrade/upgrade-articles.in b/etc/upgrade/upgrade-articles.in
index 9fdecb3..611aa29 100644
--- a/etc/upgrade/upgrade-articles.in
+++ b/etc/upgrade/upgrade-articles.in
@@ -157,6 +157,7 @@ sub copy_tables {
     use RT::CustomFields;
     my $cfs = RT::CustomFields->new(RT->SystemUser);
     $cfs->Limit( FIELD => 'LookupType', VALUE => 'RT::FM::Class-RT::FM::Article' );
+    $cfs->{'find_disabled_rows'} = 1;
     while ( my $cf = $cfs->Next ) {
         my ($ret, $msg) = $cf->__Set( Field => 'LookupType', Value => 'RT::Class-RT::Article' );
         warn "Update Custom Field LookupType for CF.".$cf->Id." $msg";
@@ -167,6 +168,7 @@ sub copy_tables {
     use RT::ObjectCustomFieldValues;
     my $ocfvs = RT::ObjectCustomFieldValues->new(RT->System);
     $ocfvs->Limit( FIELD => 'ObjectType', VALUE => 'RT::FM::Article' );
+    $ocfvs->{'find_expired_rows'} = 1;
     while ( my $ocfv = $ocfvs->Next ) {
         my ($ret, $msg) = $ocfv->__Set( Field => 'ObjectType', Value => 'RT::Article' );
         warn "Updated CF ".$ocfv->__Value('CustomField')." Value for Article ".$ocfv->__Value('ObjectId');

commit 9d60fbcd534f0f999742db4c909fa35cb4a54c27
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Nov 22 15:23:34 2013 -0500

    Copy of the upgrade-articles logic to catch dangling disabled records
    
    We'll also need to add this as 4.2.2 for anyone on 4.2.1 who ran a
    previous version of upgrade-articles that left behind OCFV records with
    ObjectType = 'RT::FM::Article'

diff --git a/etc/upgrade/4.0.19/content b/etc/upgrade/4.0.19/content
new file mode 100644
index 0000000..20571ab
--- /dev/null
+++ b/etc/upgrade/4.0.19/content
@@ -0,0 +1,29 @@
+use strict;
+use warnings;
+
+our @Initial = (
+    sub {
+        use RT::CustomFields;
+        my $cfs = RT::CustomFields->new(RT->SystemUser);
+        $cfs->{'find_disabled_rows'} = 1;
+        $cfs->Limit( FIELD => 'LookupType', VALUE => 'RT::FM::Class-RT::FM::Article' );
+        while ( my $cf = $cfs->Next ) {
+            my ($ret, $msg) = $cf->__Set( Field => 'LookupType', Value => 'RT::Class-RT::Article' );
+            RT->Logger->warnings("Update Custom Field LookupType for CF.".$cf->Id." $msg");
+        }
+        return 1;
+    },
+
+    sub {
+        use RT::ObjectCustomFieldValues;
+        my $ocfvs = RT::ObjectCustomFieldValues->new(RT->System);
+        $ocfvs->{'find_expired_rows'} = 1;
+        $ocfvs->Limit( FIELD => 'ObjectType', VALUE => 'RT::FM::Article' );
+        while ( my $ocfv = $ocfvs->Next ) {
+            my ($ret, $msg) = $ocfv->__Set( Field => 'ObjectType', Value => 'RT::Article' );
+            RT->Logger->warning("Updated CF ".$ocfv->__Value('CustomField')." Value for Article ".$ocfv->__Value('ObjectId'));
+        }
+        return 1;
+    },
+);
+

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


More information about the rt-commit mailing list