Commit 0840f73d authored by sikeda's avatar sikeda
Browse files

[dev] Removed unneccessary 'client' and 'daemon' parameters for Log::db_log(),...

[dev] Removed unneccessary 'client' and 'daemon' parameters for Log::db_log(), Log::db_stat_log() etc.  Public function get_daemon_name() was obsoleted.


git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@11972 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent bc7223ff
This diff is collapsed.
......@@ -247,8 +247,17 @@ sub do_connect {
}
}
# MOVED to Sympa::Tools::Daemon::get_daemon_name().
#sub set_daemon;
# Old names: Log::set_daemon(), Sympa::Tools::Daemon::get_daemon_name().
my $daemon_name;
sub _daemon_name {
return $daemon_name if $daemon_name;
my @path = split /\//, $PROGRAM_NAME;
$daemon_name = $path[$#path];
$daemon_name =~ s/(\.[^\.]+)$//;
return $daemon_name;
}
sub get_log_date {
my $sth;
......@@ -279,9 +288,9 @@ sub db_log {
my $msg_id = tools::clean_msg_id($arg->{'msg_id'});
my $status = $arg->{'status'};
my $error_type = $arg->{'error_type'};
my $user_email = tools::clean_msg_id($arg->{'user_email'});
my $user_email = $arg->{'user_email'};
my $client = $arg->{'client'};
my $daemon = $arg->{'daemon'};
my $daemon = _daemon_name();
my $date = time;
my $random = int(rand(1000000));
# my $id = $date * 1000000 + $random;
......@@ -342,7 +351,7 @@ sub db_stat_log {
my $operation = $arg->{'operation'};
my $date = time; #epoch time : time since 1st january 1970
my $mail = $arg->{'mail'};
my $daemon = $arg->{'daemon'};
my $daemon = _daemon_name();
my $ip = $arg->{'client'};
my $robot = $arg->{'robot'};
my $parameter = $arg->{'parameter'};
......
......@@ -51,24 +51,8 @@ use Log;
use tools;
use Sympa::Tools::File;
=over
=item get_daemon_name($path)
Returns a name for current process, suitable for logging.
=back
=cut
# Old name: Log::set_daemon().
sub get_daemon_name {
my $daemon_tmp = shift;
my @path = split(/\//, $daemon_tmp);
my $daemon = $path[$#path];
$daemon =~ s/(\.[^\.]+)$//;
return $daemon;
}
# Moved to Log::_daemon_name().
#sub get_daemon_name;
=over
......
......@@ -53,12 +53,7 @@ use Sympa::Tools::Daemon;
use Sympa::Tools::File;
use Sympa::Tools::Time;
my $daemon_name = Sympa::Tools::Daemon::get_daemon_name($0);
my $ip = $ENV{'REMOTE_HOST'};
#getopts('dF');
## Check options
# Check options
my %options;
unless (
GetOptions(
......@@ -479,8 +474,6 @@ sub remove {
'operation' => 'remove archive',
'parameter' => '',
'mail' => 'test@cru.fr',
'client' => $ip,
'daemon' => $daemon_name
}
);
......@@ -495,8 +488,6 @@ sub remove {
'status' => 'succes',
'error_type' => '',
'user_email' => '',
'client' => $ip,
'daemon' => $daemon_name
}
)
) {
......
......@@ -82,8 +82,6 @@ my %equiv = (
"User's Disk Quota Exceeded:" => '4.2.2'
);
my $daemon_name = Sympa::Tools::Daemon::get_daemon_name($0);
## Check options
my %options;
unless (
......@@ -368,7 +366,6 @@ while (!$end) {
'target_email' => $who,
'status' => 'error',
'error_type' => 'welcome_bounced',
'daemon' => $daemon_name
}
);
......@@ -378,8 +375,6 @@ while (!$end) {
'operation' => 'auto_del',
'parameter' => "",
'mail' => $who,
'client' => "",
'daemon' => 'bounced.pl'
}
);
......@@ -2097,7 +2092,6 @@ sub _update_subscriber_bounce_history {
'msg_id' => '',
'status' => 'error',
'error_type' => $status,
'daemon' => $daemon_name
}
);
} else {
......@@ -2113,7 +2107,6 @@ sub _update_subscriber_bounce_history {
'msg_id' => '',
'status' => 'error',
'error_type' => $status,
'daemon' => $daemon_name
}
);
}
......
......@@ -47,7 +47,6 @@ use Sympa::Tools::Data;
use Sympa::Tools::DKIM;
use Sympa::Tracking;
my $daemon_name = Sympa::Tools::Daemon::get_daemon_name($0);
my $date_of_last_activity = time();
local $main::daemon_usage =
'DAEMON_MASTER'; ## Default is to launch bulk as master daemon.
......
......@@ -48,7 +48,6 @@ use Log;
use Sympa::Mailer;
use Sympa::Report;
use tools;
use Sympa::Tools::Daemon;
use Sympa::Tools::Data;
use Sympa::Tools::Password;
use Sympa::Upgrade;
......@@ -56,12 +55,7 @@ use Sympa::Upgrade;
## Init random engine
srand(time());
my $daemon_name = Sympa::Tools::Daemon::get_daemon_name($0);
my $ip;
$ip = $ENV{'REMOTE_HOST'};
$ip = $ENV{'REMOTE_ADDR'} unless ($ip);
## Check --dump option
# Check options.
my %options;
unless (
GetOptions(
......@@ -1142,8 +1136,6 @@ sub SendDigest {
'status' => 'error',
'error_type' => 'unknown_list',
'user_email' => '',
'client' => $ip,
'daemon' => $daemon_name
}
);
unlink $filename;
......@@ -1176,8 +1168,6 @@ sub SendDigest {
'status' => 'success',
'error_type' => '',
'user_email' => '',
'client' => $ip,
'daemon' => $daemon_name
}
);
}
......
......@@ -53,9 +53,7 @@ use Sympa::Tools::Password;
## Init random engine
srand(time());
my $daemon_name = Sympa::Tools::Daemon::get_daemon_name($0);
## Check --dump option
# Check options.
my %options;
unless (
GetOptions(
......@@ -455,8 +453,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'unable_create_message',
'user_email' => '',
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -476,8 +472,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'no_message_id',
'user_email' => $message->{'sender'},
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -517,8 +511,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'no_sender',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -540,8 +532,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'unknown_robot',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -688,8 +678,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -724,8 +712,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'dyn_cant_sync',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
# purge the unwanted empty automatic list
......@@ -772,8 +758,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'list_unknown',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
# purge the unwanted empty automatic list
......
......@@ -60,11 +60,10 @@ my $digestsleep = 5;
## Init random engine
srand(time());
my $daemon_name = Sympa::Tools::Daemon::get_daemon_name($0);
# Default is to launch process as master daemon.
my $daemon_usage = 'DAEMON_MASTER';
## Check --dump option
# Check options.
my %options;
unless (
GetOptions(
......@@ -582,8 +581,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'unable_create_message',
'user_email' => '',
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -603,8 +600,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'no_message_id',
'user_email' => $message->{'sender'},
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -644,8 +639,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'no_sender',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -667,8 +660,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'unknown_robot',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -742,8 +733,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'unknown_list',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -843,8 +832,6 @@ sub process_message {
'status' => 'error',
'error_type' => 'virus',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -939,8 +926,6 @@ sub process_message {
'status' => 'success',
'error_type' => '',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
......@@ -1141,8 +1126,6 @@ sub DoForward {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1189,8 +1172,6 @@ sub DoForward {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1205,8 +1186,6 @@ sub DoForward {
'status' => 'success',
'error_type' => '',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
......@@ -1307,8 +1286,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'known_message',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1332,8 +1309,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'routing_error',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1356,8 +1331,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1392,8 +1365,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'message_too_large',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1480,8 +1451,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1549,8 +1518,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1604,8 +1571,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1623,8 +1588,6 @@ sub DoMessage {
'status' => 'success',
'error_type' => 'kept_for_auth',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return 1;
......@@ -1672,8 +1635,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1744,8 +1705,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1820,8 +1779,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'rejected_authorization',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1844,8 +1801,6 @@ sub DoMessage {
'status' => 'error',
'error_type' => 'internal',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1911,8 +1866,6 @@ sub DoCommand {
'status' => 'error',
'error_type' => 'known_message',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -1945,8 +1898,6 @@ sub DoCommand {
'status' => 'success',
'error_type' => '',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return 1;
......@@ -1995,8 +1946,6 @@ sub DoCommand {
'status' => 'error',
'error_type' => 'error_content_type',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return $success;
......@@ -2031,8 +1980,6 @@ sub DoCommand {
'status' => 'error',
'error_type' => 'not_understood',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
last;
......@@ -2059,8 +2006,6 @@ sub DoCommand {
'status' => 'error',
'error_type' => 'no_cmd_found',
'user_email' => $sender,
#'client' => $ip,
'daemon' => $daemon_name
}
);
return undef;
......@@ -2133,8 +2078,6 @@ sub SendDigest {
'status' => 'error',
'error_type' => 'unknown_list',
'user_email' => '',
#'client' => $ip,
'daemon' => $daemon_name
}
);
unlink $filename;
......@@ -2167,8 +2110,6 @@ sub SendDigest {
'status' => 'success',
'error_type' => '',
'user_email' => '',
#'client' => $ip,
'daemon' => $daemon_name
}
);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment