use FS::Misc::prune qw(prune_applications);
use FS::Conf;
use FS::Record qw(qsearch);
-use FS::Upgrade qw(upgrade);
+use FS::Upgrade qw(upgrade upgrade_sqlradius);
die "Not running uid freeside!" unless checkeuid();
my $hashref = {};
$hashref->{dry_run} = 1 if $DRY_RUN;
-$hashref->{debug} = 1 if $DEBUG;
-print join "\n", prune_applications($hashref) unless $opt_s;
+$hashref->{debug} = 1 if $DEBUG && $DRY_RUN;
+prune_applications($hashref) unless $opt_s;
+
print "\n" if $DRY_RUN;
if ( $dbh->{Driver}->{Name} =~ /^mysql/i && ! $opt_s ) {
- my $sth = $dbh->prepare(
- "SELECT COUNT(*) FROM duplicate_lock WHERE lockname = 'svc_acct'"
- ) or die $dbh->errstr;
-
- $sth->execute or die $sth->errstr;
-
- unless ( $sth->fetchrow_arrayref->[0] ) {
+ foreach my $table (qw( svc_acct svc_phone )) {
- $sth = $dbh->prepare(
- "INSERT INTO duplicate_lock ( lockname ) VALUES ( 'svc_acct' )"
+ my $sth = $dbh->prepare(
+ "SELECT COUNT(*) FROM duplicate_lock WHERE lockname = '$table'"
) or die $dbh->errstr;
$sth->execute or die $sth->errstr;
+ unless ( $sth->fetchrow_arrayref->[0] ) {
+
+ $sth = $dbh->prepare(
+ "INSERT INTO duplicate_lock ( lockname ) VALUES ( '$table' )"
+ ) or die $dbh->errstr;
+
+ $sth->execute or die $sth->errstr;
+
+ }
+
}
+
}
$dbh->commit or die $dbh->errstr;