Remove unused ScheduledTaskSubscriber model methods
[MAILPOET-4006]
This commit is contained in:
committed by
Veljko V
parent
11d4ae47a8
commit
1cb89dd41d
@ -3,8 +3,6 @@
|
||||
namespace MailPoet\Models;
|
||||
|
||||
use MailPoet\Entities\ScheduledTaskSubscriberEntity;
|
||||
use MailPoet\Util\Helpers;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
/**
|
||||
* @property int $taskId
|
||||
@ -72,84 +70,6 @@ class ScheduledTaskSubscriber extends Model {
|
||||
return self::getCount($taskId, self::STATUS_PROCESSED);
|
||||
}
|
||||
|
||||
public static function getTotalCount($taskId) {
|
||||
return self::getCount($taskId);
|
||||
}
|
||||
|
||||
public static function listingQuery($data) {
|
||||
$group = isset($data['group']) ? $data['group'] : 'all';
|
||||
$query = self::join(Subscriber::$_table, ["subscriber_id", "=", "subscribers.id"], "subscribers")
|
||||
->filter($group, $data['params'])
|
||||
->select('error', 'error')
|
||||
->select('failed', 'failed')
|
||||
->select('task_id', 'taskId')
|
||||
->select('processed', 'processed')
|
||||
->select('subscribers.email', 'email')
|
||||
->select('subscribers.id', 'subscriberId')
|
||||
->select('subscribers.last_name', 'lastName')
|
||||
->select('subscribers.first_name', 'firstName');
|
||||
if (isset($data['search'])) {
|
||||
$search = trim($data['search']);
|
||||
$search = Helpers::escapeSearch($search);
|
||||
if (strlen($search) === 0) {
|
||||
return $query;
|
||||
}
|
||||
$search = '%' . $search . '%';
|
||||
return $query->whereRaw(
|
||||
'(`subscribers`.`email` LIKE ? OR `subscribers`.`first_name` LIKE ? OR `subscribers`.`last_name` LIKE ?)',
|
||||
[$search, $search, $search]
|
||||
);
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
public static function groups($data) {
|
||||
$params = $data['params'];
|
||||
return [
|
||||
[
|
||||
'name' => 'all',
|
||||
'label' => WPFunctions::get()->__('All', 'mailpoet'),
|
||||
'count' => self::filter('all', $params)->count(),
|
||||
],
|
||||
[
|
||||
'name' => self::SENDING_STATUS_SENT,
|
||||
'label' => WPFunctions::get()->_x('Sent', 'status when a newsletter has been sent', 'mailpoet'),
|
||||
'count' => self::filter(self::SENDING_STATUS_SENT, $params)->count(),
|
||||
],
|
||||
[
|
||||
'name' => self::SENDING_STATUS_FAILED,
|
||||
'label' => WPFunctions::get()->_x('Failed', 'status when the sending of a newsletter has failed', 'mailpoet'),
|
||||
'count' => self::filter(self::SENDING_STATUS_FAILED, $params)->count(),
|
||||
],
|
||||
[
|
||||
'name' => self::SENDING_STATUS_UNPROCESSED,
|
||||
'label' => WPFunctions::get()->_x('Unprocessed', 'status when the sending of a newsletter has not been processed', 'mailpoet'),
|
||||
'count' => self::filter(self::SENDING_STATUS_UNPROCESSED, $params)->count(),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public static function all($orm, $params) {
|
||||
return $orm->whereIn('task_id', $params['task_ids']);
|
||||
}
|
||||
|
||||
public static function sent($orm, $params) {
|
||||
return $orm->filter('all', $params)
|
||||
->where('processed', self::STATUS_PROCESSED)
|
||||
->where('failed', self::FAIL_STATUS_OK);
|
||||
}
|
||||
|
||||
public static function failed($orm, $params) {
|
||||
return $orm->filter('all', $params)
|
||||
->where('processed', self::STATUS_PROCESSED)
|
||||
->where('failed', self::FAIL_STATUS_FAILED);
|
||||
}
|
||||
|
||||
public static function unprocessed($orm, $params) {
|
||||
return $orm->filter('all', $params)
|
||||
->where('processed', self::STATUS_UNPROCESSED);
|
||||
}
|
||||
|
||||
private static function getCount($taskId, $processed = null) {
|
||||
$orm = self::where('task_id', $taskId);
|
||||
if (!is_null($processed)) {
|
||||
|
Reference in New Issue
Block a user