my $messagesub=shift;
my $diffsub=shift;
my $user=shift;
- my @changed_pages=shift;
+ my @changed_pages=@_;
+
+ return unless @changed_pages;
my @email_recipients=commit_notify_list($user, @changed_pages);
if (@email_recipients) {
);
# Daemonize, in case the mail sending takes a while.
+ defined(my $pid = fork) or error("Can't fork: $!");
+ return if $pid;
+ setsid() or error("Can't start a new session: $!");
eval q{use POSIX ’setsid’};
chdir '/';
open STDIN, '/dev/null';
open STDOUT, '>/dev/null';
- defined(my $pid = fork) or error("Can't fork: $!");
- return if $pid;
- setsid() or error("Can't start a new session: $!");
open STDERR, '>&STDOUT' or error("Can’t dup stdout: $!");
+ unlockwiki(); # don't need to keep a lock on the wiki
+
eval q{use Mail::Sendmail};
error($@) if $@;
foreach my $email (@email_recipients) {
Message => $template->output,
) or error("Failed to send update notification mail");
}
+
+ exit 0; # daemon process done
}
} #}}}