38 lines
864 B
PHP
38 lines
864 B
PHP
<?php
|
|
namespace MailPoet\Models;
|
|
|
|
if(!defined('ABSPATH')) exit;
|
|
|
|
class SendingQueue extends Model {
|
|
public static $_table = MP_SENDING_QUEUES_TABLE;
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
function pause() {
|
|
if($this->count_processed === $this->count_total) {
|
|
return false;
|
|
} else {
|
|
$this->set('status', 'paused');
|
|
$this->save();
|
|
return ($this->getErrors() === false && $this->id() > 0);
|
|
}
|
|
}
|
|
|
|
function resume() {
|
|
if($this->count_processed === $this->count_total) {
|
|
return $this->complete();
|
|
} else {
|
|
$this->set_expr('status', 'NULL');
|
|
$this->save();
|
|
return ($this->getErrors() === false && $this->id() > 0);
|
|
}
|
|
}
|
|
|
|
function complete() {
|
|
$this->set('status', 'completed');
|
|
$this->save();
|
|
return ($this->getErrors() === false && $this->id() > 0);
|
|
}
|
|
} |