# log_parser.pl # Functions for parsing this module's logs do 'virtual-server-lib.pl'; # parse_webmin_log(user, script, action, type, object, ¶ms) # Converts logged information from this module into human-readable form sub parse_webmin_log { local ($user, $script, $action, $type, $object, $p, $long) = @_; if ($type eq "user") { return &text('log_'.$action.'_user', "$object", "$p->{'dom'}"); } elsif ($type eq "users") { return &text('log_'.$action.'_users', $object, "$p->{'dom'}"); } elsif ($type eq "alias") { return &text('log_'.$action.'_alias', "$object"); } elsif ($type eq "admin") { return &text('log_'.$action.'_admin', "$object"); } elsif ($type eq "aliases") { return &text('log_'.$action.'_aliases', $object, "$p->{'dom'}"); } elsif ($type eq "domain") { return &text('log_'.$action.'_domain', "$object"); } elsif ($type eq "domains") { return &text('log_'.$action.'_domains', $object); } elsif ($type eq "balancer") { return &text('log_'.$action.'_balancer', "$object", "$p->{'dom'}"); } elsif ($type eq "balancers") { return &text('log_'.$action.'_balancers', $object, "$p->{'dom'}"); } elsif ($type eq "resel") { return &text('log_'.$action.'_resel', "$object"); } elsif ($type eq "resels") { return &text('log_'.$action.'_resels', $object); } elsif ($type eq "template") { return &text('log_'.$action.'_template', &html_escape($object)); } elsif ($type eq "templates") { return &text('log_'.$action.'_template', $object); } elsif ($type eq "script") { return &text('log_'.$action.'_script', $object, $p->{'ver'}, "$p->{'dom'}"); } elsif ($type eq "scripts" && ($action eq "upgrade" || $action eq "uninstall" || $action eq "warn")) { return &text('log_'.$action.'_scripts', $object); } elsif ($type eq "scripts") { local @scripts = map { /^(.*)\.pl$/ ? "$1" : "$_" } split(/\0/, $p->{'scripts'}); return &text('log_'.$action.'_scripts', join(" ", @scripts)); } elsif ($type eq "styles" && $action eq "add") { return &text('log_add_styles', $object); } elsif ($type eq "styles" && $action eq "enable") { return $text{'log_enable_styles'}; } elsif ($type eq "database") { return &text('log_'.$action.'_database', "$object", $text{'databases_'.$p->{'type'}}, "$p->{'dom'}"); } elsif ($type eq "links" || $type eq "linkcats" || $type eq "fields") { return $text{'log_'.$action.'_'.$type}; } elsif ($action eq "start" || $action eq "stop" || $action eq "restart") { return $text{'log_'.$action.'_'.$type}; } elsif ($action eq "backup" || $action eq "restore") { local @doms = split(/\0/, $p->{'doms'}); if ($long) { return &text('log_'.$action.'_l', join(" ", map { "$_" } @doms)); } else { return &text('log_'.$action, scalar(@doms)); } } elsif ($action eq "sched") { return $text{'log_sched_'.$type}; } elsif ($action eq "notify" || $action eq "mailusers") { return &text('log_'.$action, scalar(split(/\0/, $p->{'to'}))); } elsif ($action eq "shells") { return $text{'log_shells'.int($object)}; } else { return $text{'log_'.$action}; } return undef; }