- local $SIG{HUP} = 'IGNORE';
- local $SIG{INT} = 'IGNORE';
- local $SIG{QUIT} = 'IGNORE';
- local $SIG{TERM} = 'IGNORE';
- local $SIG{TSTP} = 'IGNORE';
- local $SIG{PIPE} = 'IGNORE';
-
- my $error = $new->SUPER::replace($old);
- return $error if $error;
-
- if ( $new->srcsvc != $old->srcsvc ) {
- my $old_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $old->srcsvc } );
- my $old_username = $old_svc_acct->username;
- my $old_domain = $old_svc_acct->domain;
- foreach my $vpopmailmachine ( @vpopmailmachines ) {
- my($machine, $vpopdir, $vpopuid, $vpopgid) =
- split(/\s+/, $vpopmailmachine);
- ssh("root\@$machine","rm $vpopdir/$old_domain/$old_username/.qmail")
- unless $nossh_hack;
- }
- }
-
- #false laziness with stuff in insert, should subroutine
- my $svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $new->srcsvc } );
- my $username = $svc_acct->username;
- my $domain = $svc_acct->domain;
- my $destination;
- if ($new->dstsvc) {
- my $dst_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $new->dstsvc } );
- $destination = $dst_svc_acct->email;
- } else {
- $destination = $new->dst;
- }
-
- foreach my $vpopmailmachine ( @vpopmailmachines ) {
- my($machine, $vpopdir, $vpopuid, $vpopgid) = split(/\s+/, $vpopmailmachine);
- ssh("root\@$machine","[ -d $vpopdir/$domain/$username ] || { echo \"$destination\" >> $vpopdir/$domain/$username/.qmail; chown $vpopuid:$vpopgid $vpopdir/$domain/$username/.qmail; }")
- unless $nossh_hack;
- }
- #end subroutinable bits
- }
- '';