- Updates Mailer class to use default values from Settings
This commit is contained in:
@ -19,6 +19,7 @@ class TaskScheduler {
|
||||
}
|
||||
|
||||
function init() {
|
||||
try {
|
||||
// configure task scheduler only outside of cli environment
|
||||
if(php_sapi_name() === 'cli') return;
|
||||
switch($this->method) {
|
||||
@ -32,15 +33,15 @@ class TaskScheduler {
|
||||
throw new \Exception(__("Task scheduler is not configured"));
|
||||
break;
|
||||
};
|
||||
} catch(\Exception $e) {
|
||||
// ignore exceptions as they should not prevent the rest of the site from loading
|
||||
}
|
||||
}
|
||||
|
||||
function configureMailpoetScheduler() {
|
||||
try {
|
||||
$supervisor = new Supervisor();
|
||||
$supervisor->checkDaemon();
|
||||
} catch(\Exception $e) {
|
||||
// exceptions should not prevent the rest of the site loading
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
function configureWordpressScheduler() {
|
||||
|
@ -103,6 +103,11 @@ class Mailer {
|
||||
$mailer = Setting::getValue(self::MAILER_CONFIG);
|
||||
if(!$mailer || !isset($mailer['method'])) throw new \Exception(__('Mailer is not configured'));
|
||||
}
|
||||
if(empty($mailer['frequency'])) {
|
||||
$default_settings = Setting::getDefaults();
|
||||
$mailer['frequency'] = $default_settings['mta']['frequency'];
|
||||
}
|
||||
// add additional variables to the mailer object
|
||||
$mailer['class'] = 'MailPoet\\Mailer\\Methods\\' . $mailer['method'];
|
||||
$mailer['frequency_interval'] =
|
||||
(int)$mailer['frequency']['interval'] * self::SENDING_LIMIT_INTERVAL_MULTIPLIER;
|
||||
|
Reference in New Issue
Block a user