diff options
author | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
---|---|---|
committer | cvs2git <cvs2git> | 2010-12-27 00:04:45 +0000 |
commit | c82d349f864e6bd9f96fd1156903bc1f7193a203 (patch) | |
tree | e117a87533656110b6acd56fc0ca64289892a9f5 /bin/rt-trim-whitespace | |
parent | 74e058c8a010ef6feb539248a550d0bb169c1e94 (diff) |
This commit was manufactured by cvs2svn to create tag 'TORRUS_1_0_9'.TORRUS_1_0_9
Diffstat (limited to 'bin/rt-trim-whitespace')
-rwxr-xr-x | bin/rt-trim-whitespace | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/bin/rt-trim-whitespace b/bin/rt-trim-whitespace deleted file mode 100755 index 503d9cff7..000000000 --- a/bin/rt-trim-whitespace +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use FS::Record; -use FS::UID qw(adminsuidsetup dbh driver_name); - -# Remove trailing whitespace from custom field option lists and values. - -my $dbh = adminsuidsetup(shift) or die "Usage: rt-trim-whitespace username\n"; -die "rt-trim-whitespace only works on Pg databases" if driver_name ne 'Pg'; - -my @updates = ( - customfieldvalues => 'name', - objectcustomfieldvalues => 'content', -); - -while(@updates) { - my $table = shift @updates; - my $field = shift @updates; - my $select = -"SELECT $field FROM $table WHERE $field != substring($field from ". - q!E'^(.*\\\\S)\\\\s*$'! . ')'; - - print "$select\n"; - my $rows = $dbh->do($select); - print "$rows rows found.\n"; - - if($rows) { - my $update = -"UPDATE $table SET $field = substring($field from ".q!E'^(.*\\\\S)\\\\s*$'!.')'. -" WHERE $field != substring($field from ".q!E'^(.*\\\\S)\\\\s*$'!.')'; - print "$update\n"; - my $rows = $dbh->do($update); - print "$rows updated.\n"; - } -} -$dbh->commit or die $dbh->errstr; |