projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kundenstatistik: erster commit ohne Webtemplates
[kivitendo-erp.git]
/
SL
/
BackgroundJob
/
SelfTest.pm
diff --git
a/SL/BackgroundJob/SelfTest.pm
b/SL/BackgroundJob/SelfTest.pm
index
37a02eb
..
bb62467
100644
(file)
--- a/
SL/BackgroundJob/SelfTest.pm
+++ b/
SL/BackgroundJob/SelfTest.pm
@@
-11,7
+11,10
@@
use Sys::Hostname;
use FindBin;
use SL::DB::AuthUser;
use FindBin;
use SL::DB::AuthUser;
+use SL::DB::Default;
use SL::Common;
use SL::Common;
+use SL::Locale::String qw(t8);
+use Carp;
use Rose::Object::MakeMethods::Generic (
array => [
use Rose::Object::MakeMethods::Generic (
array => [
@@
-60,11
+63,13
@@
sub run {
$self->aggreg->failed,
$self->aggreg->todo_passed,
);
$self->aggreg->failed,
$self->aggreg->todo_passed,
);
-
- if (!$self->aggreg->all_passed || $self->config->{send_email_on_success}) {
+ # if (!$self->aggreg->all_passed || $self->config->{send_email_on_success}) {
+ # all_passed is not set or calculated (anymore). it is safe to check only for probs or errors
+ if ($self->aggreg->failed || $self->config->{send_email_on_success}) {
$self->_send_email;
}
$self->_send_email;
}
+ croak t8("Unsuccessfully executed:" . join ("\n", $self->errors)) if $self->errors;
return 1;
}
return 1;
}
@@
-91,11
+96,10
@@
sub run_module {
} or $self->add_errors($::locale->text('Could not load class #1 (#2): "#3"', $module, $file, $@)) && return;
eval {
} or $self->add_errors($::locale->text('Could not load class #1 (#2): "#3"', $module, $file, $@)) && return;
eval {
- my $worker = $module->new;
- $worker->tester($self->tester);
-
- $worker->run;
- 1;
+ $self->tester->subtest($module => sub {
+ $module->new->run;
+ });
+ 1
} or $self->add_errors($::locale->text('Could not load class #1, #2', $module, $@)) && return;
$self->add_full_diag($output);
} or $self->add_errors($::locale->text('Could not load class #1, #2', $module, $@)) && return;
$self->add_full_diag($output);
@@
-123,7
+127,7
@@
sub _send_email {
my ($output, $content_type) = $self->_prepare_report;
my ($output, $content_type) = $self->_prepare_report;
- my $mail = Mailer->new
(charset => $::locale->is_utf8 ? 'UTF-8' : Common->DEFAULT_CHARSET )
;
+ my $mail = Mailer->new;
$mail->{from} = $self->config->{email_from};
$mail->{to} = $email;
$mail->{subject} = $self->config->{email_subject};
$mail->{from} = $self->config->{email_from};
$mail->{to} = $email;
$mail->{subject} = $self->config->{email_subject};
@@
-145,15
+149,17
@@
sub _prepare_report {
return unless $template;
my $email_template = $self->config->{email_template};
return unless $template;
my $email_template = $self->config->{email_template};
- my $filename = $email_template || ( (
$user->get_config_value('templates')
|| "templates/mails") . "/self_test/status_mail.txt" );
+ my $filename = $email_template || ( (
SL::DB::Default->get->templates
|| "templates/mails") . "/self_test/status_mail.txt" );
my $content_type = $filename =~ m/.html$/ ? 'text/html' : 'text/plain';
my %params = (
SELF => $self,
host => hostname,
my $content_type = $filename =~ m/.html$/ ? 'text/html' : 'text/plain';
my %params = (
SELF => $self,
host => hostname,
- database => $::myconfig{dbname},
+ database => $::auth->client->{dbname},
+ client => $::auth->client->{name},
path => $FindBin::Bin,
path => $FindBin::Bin,
+ errors => $self->errors,
);
my $output;
);
my $output;