[Rt-commit] rt branch, 4.2/links_in_validator, updated. rt-3.8.8-254-g3590144

Kevin Falcone falcone at bestpractical.com
Fri Feb 18 21:29:51 EST 2011


The branch, 4.2/links_in_validator has been updated
       via  359014428439321cf8cad00897f3fd67605d49fe (commit)
       via  12a76fef600c5959fcd0ad04d71bfe07c88c8fda (commit)
      from  89b6493297c005ebc00f050bddcaa3e7ce8c3fac (commit)

Summary of changes:
 sbin/rt-validator.in |   30 ++++++++++++++++++------------
 1 files changed, 18 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit 12a76fef600c5959fcd0ad04d71bfe07c88c8fda
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 18 20:45:37 2011 -0500

    Minor english frobs

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index cf9488f..3d0af6a 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -105,8 +105,8 @@ Options:
 
 Description:
 
-This script checks integrity of records in RT's DB. May delete some invalid
-records or ressurect accidentally deleted.
+This script checks the integrity of records in RT's DB. May be used to delete
+some invalid records or ressurect accidentally deleted records.
 
 END
     exit 1;
@@ -115,8 +115,8 @@ END
 sub usage_warning {
     print <<END;
 This utility can fix some issues with DB by creating or updating. In some
-cases there is no enough data to resurect a missing record, but records which
-refers to a missing can be deleted. It's up to you to decide what to do.
+cases there is not enough data to resurect a missing record, but records which
+refer to a missing record can be deleted. It's up to you to decide what to do.
 
 In any case it's highly recommended to have a backup before resolving anything.
 
@@ -226,7 +226,7 @@ my (@do_check, %redo_check);
 my @CHECKS;
 foreach my $table ( qw(Users Groups) ) {
     push @CHECKS, "$table -> Principals" => sub {
-        my $msg = "A record in $table refers not existing record in Principals."
+        my $msg = "A record in $table refers to a nonexistent record in Principals."
             ." The script can either create missing record in Principals"
             ." or delete record in $table.";
         my ($type) = ($table =~ /^(.*)s$/);
@@ -254,7 +254,7 @@ foreach my $table ( qw(Users Groups) ) {
     };
 
     push @CHECKS, "Principals -> $table" => sub {
-        my $msg = "A record in Principals refers not existing record in $table."
+        my $msg = "A record in Principals refers to a nonexistent record in $table."
             ." In some cases it's possible to resurrect manually such records,"
             ." but this utility can only delete";
 
@@ -489,7 +489,7 @@ push @CHECKS, 'CGM vs. GM' => sub {
             my $id = shift;
             return unless prompt(
                 'Delete',
-                "Found a record in CachedGroupMembers with Via referencing not existing record."
+                "Found a record in CachedGroupMembers with Via referencing a nonexistent record."
             );
 
             delete_record( 'CachedGroupMembers', $id );

commit 359014428439321cf8cad00897f3fd67605d49fe
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Fri Feb 18 21:21:18 2011 -0500

    Add a --links-only
    
    Allow a user to only correct their links, without running a series of
    very expensive queries against potentially large Transactions tables.
    
    This is useful if you change $Organization and want to fix everything.

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 3d0af6a..0c82ae4 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -82,6 +82,7 @@ GetOptions(
     'resolve',
     'force',
     'verbose|v',
+    'links-only',
 );
 
 usage() unless $opt{'check'};
@@ -98,10 +99,12 @@ Options:
     $0 --check --verbose --resolve
     $0 --check --verbose --resolve --force
 
---check   - is mandatory argument, you can use -c, as well.
---verbose - print additional info to STDOUT
---resolve - enable resolver that can delete or create some records
---force   - resolve without asking questions
+--check      - is mandatory argument, you can use -c, as well.
+--verbose    - print additional info to STDOUT
+--resolve    - enable resolver that can delete or create some records
+--force      - resolve without asking questions
+--links-only - only run the Link validation routines, useful if you changed your
+               Organization
 
 Description:
 
@@ -1044,11 +1047,14 @@ push @CHECKS, 'Links: missing object' => sub {
 };
 
 
-
 my %CHECKS = @CHECKS;
 
 @do_check = do { my $i = 1; grep $i++%2, @CHECKS };
 
+if ($opt{'links-only'}) {
+    @do_check = grep { /^Links:/ } @do_check;
+}
+
 while ( my $check = shift @do_check ) {
     $CHECKS{ $check }->();
 

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


More information about the Rt-commit mailing list