- Removes unused method from Settings model
- Renames method to delete value
This commit is contained in:
@ -42,7 +42,7 @@ class CronHelper {
|
||||
}
|
||||
|
||||
static function deleteDaemon() {
|
||||
return Setting::deleteSetting(self::DAEMON_SETTING);
|
||||
return Setting::deleteValue(self::DAEMON_SETTING);
|
||||
}
|
||||
|
||||
static function createToken() {
|
||||
|
@ -8,30 +8,30 @@ if(!defined('ABSPATH')) exit;
|
||||
class MailerLog {
|
||||
const MAILER_LOG_CONFIG = 'mta_log';
|
||||
|
||||
static function getMailerLog() {
|
||||
$mailer_log = Setting::getValue(self::MAILER_LOG_CONFIG);
|
||||
if(!$mailer_log) {
|
||||
$mailer_log = self::createOrResetMailerLog();
|
||||
static function getMailerLog() {
|
||||
$mailer_log = Setting::getValue(self::MAILER_LOG_CONFIG);
|
||||
if(!$mailer_log) {
|
||||
$mailer_log = self::createOrResetMailerLog();
|
||||
}
|
||||
return $mailer_log;
|
||||
}
|
||||
return $mailer_log;
|
||||
}
|
||||
|
||||
static function createOrResetMailerLog() {
|
||||
$mailer_log = array(
|
||||
'sent' => 0,
|
||||
'started' => time()
|
||||
);
|
||||
Setting::setValue(self::MAILER_LOG_CONFIG, $mailer_log);
|
||||
return $mailer_log;
|
||||
}
|
||||
static function createOrResetMailerLog() {
|
||||
$mailer_log = array(
|
||||
'sent' => 0,
|
||||
'started' => time()
|
||||
);
|
||||
Setting::setValue(self::MAILER_LOG_CONFIG, $mailer_log);
|
||||
return $mailer_log;
|
||||
}
|
||||
|
||||
static function updateMailerLog($mailer_log) {
|
||||
Setting::setValue(self::MAILER_LOG_CONFIG, $mailer_log);
|
||||
return $mailer_log;
|
||||
}
|
||||
static function updateMailerLog($mailer_log) {
|
||||
Setting::setValue(self::MAILER_LOG_CONFIG, $mailer_log);
|
||||
return $mailer_log;
|
||||
}
|
||||
|
||||
static function isSendingLimitReached() {
|
||||
$mailer_config = Mailer::getMailerConfig();
|
||||
static function isSendingLimitReached() {
|
||||
$mailer_config = Mailer::getMailerConfig();
|
||||
$mailer_log = self::getMailerLog();
|
||||
$elapsed_time = time() - (int)$mailer_log['started'];
|
||||
if($mailer_log['sent'] === $mailer_config['frequency_limit'] &&
|
||||
|
@ -161,12 +161,8 @@ class Setting extends Model {
|
||||
return $setting->save();
|
||||
}
|
||||
|
||||
public static function getSetting($setting) {
|
||||
return self::where('name', $setting)->findOne();
|
||||
}
|
||||
|
||||
public static function deleteSetting($setting) {
|
||||
$setting = self::where('name', $setting)->findOne();
|
||||
return ($setting) ? $setting->delete() : false;
|
||||
public static function deleteValue($value) {
|
||||
$value = self::where('name', $value)->findOne();
|
||||
return ($value) ? $value->delete() : false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user