Files
piratepoet/lib/Models/SendingQueue.php
Tautvidas Sipavičius 168540d6d2 Remove useless constructors
2016-06-29 20:42:03 +03:00

39 lines
942 B
PHP

<?php
namespace MailPoet\Models;
if(!defined('ABSPATH')) exit;
class SendingQueue extends Model {
public static $_table = MP_SENDING_QUEUES_TABLE;
const STATUS_COMPLETED = 'completed';
const STATUS_SCHEDULED = 'scheduled';
const STATUS_PAUSED = 'paused';
function pause() {
if($this->count_processed === $this->count_total) {
return false;
} else {
$this->set('status', self::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->setExpr('status', 'NULL');
$this->save();
return ($this->getErrors() === false && $this->id() > 0);
}
}
function complete() {
$this->set('status', self::STATUS_COMPLETED);
$this->save();
return ($this->getErrors() === false && $this->id() > 0);
}
}