[Rt-commit] r16904 - rt/3.8/trunk/sbin

ruz at bestpractical.com ruz at bestpractical.com
Tue Nov 18 18:24:02 EST 2008


Author: ruz
Date: Tue Nov 18 18:24:02 2008
New Revision: 16904

Modified:
   rt/3.8/trunk/sbin/rt-validator.in

Log:
* update tables with actual problem only. generic way may be too slow

Modified: rt/3.8/trunk/sbin/rt-validator.in
==============================================================================
--- rt/3.8/trunk/sbin/rt-validator.in	(original)
+++ rt/3.8/trunk/sbin/rt-validator.in	Tue Nov 18 18:24:02 2008
@@ -836,7 +836,7 @@
                     ."that has been fixed. If other checks are ok then it's ok to update\n"
                     ."these records to point them to users instead of groups"
                 );
-                $fix{ $gid } = $uid;
+                $fix{ $table }{ $column }{ $gid } = $uid;
             };
 
             my $sth = execute_query( $query, 'ACLEquivalence', 'UserEquiv' );
@@ -853,15 +853,10 @@
     }
 
     if ( keys %fix ) {
-        foreach my $model ( @models ) {
-            my $class = "RT::$model";
-            my $object = $class->new( $RT::SystemUser );
-            my $table = $object->Table;
-            foreach my $column ( qw(LastUpdatedBy Creator) ) {
-                next unless $object->_Accessible( $column, 'auto' );
-
+        foreach my $table ( keys %fix ) {
+            foreach my $column ( keys %{ $fix{ $table } } ) {
                 my $query = "UPDATE $table SET $column = ? WHERE $column = ?";
-                while ( my ($gid, $uid) = each %fix ) {
+                while ( my ($gid, $uid) = each %{ $fix{ $table }{ $column } } ) {
                     update_records( $table, { $column => $gid }, { $column => $uid } );
                 }
             }


More information about the Rt-commit mailing list