X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fetc%2Fupgrade%2Fupgrade-articles.in;h=837e20f2cd3c8166869a12d1b1f8b97c8ae6fb8e;hb=7322f2afedcc2f427e997d1535a503613a83f088;hp=b0f13d674c54393f1170fb5b8166d538b6ad9df0;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7;p=freeside.git diff --git a/rt/etc/upgrade/upgrade-articles.in b/rt/etc/upgrade/upgrade-articles.in index b0f13d674..837e20f2c 100644 --- a/rt/etc/upgrade/upgrade-articles.in +++ b/rt/etc/upgrade/upgrade-articles.in @@ -3,7 +3,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -46,28 +46,23 @@ # those contributions and any derivatives thereof. # # END BPS TAGGED BLOCK }}} +use 5.10.1; use strict; use warnings; use lib "@LOCAL_LIB_PATH@"; use lib "@RT_LIB_PATH@"; -use RT; -RT::LoadConfig(); -RT->Config->Set('LogToScreen' => 'debug'); -RT::Init(); - -$| = 1; +use RT::Interface::CLI qw(Init); +Init(); my $db_name = RT->Config->Get('DatabaseName'); my $db_type = RT->Config->Get('DatabaseType'); my $dbh = $RT::Handle->dbh; -my $sth = $dbh->table_info( '', undef, undef, "'TABLE'"); my $found_fm_tables; -while ( my $table = $sth->fetchrow_hashref ) { - my $name = $table->{TABLE_NAME} || $table->{'table_name'}; # Oracle's table_info affected by NAME_lc +foreach my $name ( $RT::Handle->_TableNames ) { next unless $name =~ /^fm_/i; $found_fm_tables->{lc $name}++; } @@ -159,6 +154,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"; @@ -169,6 +165,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');