Revision 3be85e17
Von Moritz Bunkus vor mehr als 12 Jahren hinzugefügt
SL/DB/BackgroundJob.pm | ||
---|---|---|
use SL::DB::BackgroundJobHistory;
|
||
|
||
use SL::BackgroundJob::Test;
|
||
use SL::System::Process;
|
||
|
||
sub update_next_run_at {
|
||
my $self = shift;
|
||
... | ... | |
return {};
|
||
}
|
||
|
||
sub validate {
|
||
my ($self) = @_;
|
||
|
||
my @errors;
|
||
|
||
push @errors, $::locale->text('The execution type is invalid.') if ($self->type || '') !~ m/^(?: once | interval )$/x;
|
||
|
||
if ( (($self->package_name || '') !~ m/^ [A-Z][A-Za-z0-9]+ $/x)
|
||
|| ! -f (SL::System::Process::exe_dir() . "/SL/BackgroundJob/" . $self->package_name . ".pm")) {
|
||
push @errors, $::locale->text('The package name is invalid.');
|
||
}
|
||
|
||
eval {
|
||
DateTime::Event::Cron->new_from_cron($self->cron_spec)->next(DateTime->now_local);
|
||
1;
|
||
} or push @errors, $::locale->text('The execution schedule is invalid.');
|
||
|
||
return @errors;
|
||
}
|
||
|
||
1;
|
Auch abrufbar als: Unified diff
Validierungsfunktion für BackgroundJobs