API CHANGE Removed unused QueuedEmail and QueuedEmailDispatchTask

This commit is contained in:
Ingo Schommer 2011-03-29 21:44:54 +13:00
parent b1f27b40ce
commit 59230d8e39
2 changed files with 0 additions and 68 deletions

View File

@ -1,36 +0,0 @@
<?php
/**
* Stores a queued email to be sent at the given time
* @package sapphire
* @subpackage email
*/
class QueuedEmail extends DataObject {
static $db = array(
'Send' => 'SS_Datetime',
'Subject' => 'Varchar',
'From' => 'Varchar',
'Content' => 'Text'
);
static $has_one = array(
'To' => 'Member'
);
static $has_many = array();
static $many_many = array();
static $defaults = array();
// overwrite this method to provide a check whether or not to send the email
function canSendEmail() {
return true;
}
function send() {
$email = new Email( $this->From, $this->To()->Email, $this->Subject, $this->Content );
$email->send();
}
}
?>

View File

@ -1,32 +0,0 @@
<?php
/**
* Daily task to send queued email.
* @package sapphire
* @subpackage email
*/
class QueuedEmailDispatchTask extends DailyTask {
public function process() {
increase_time_limit_to();
echo "SENDING QUEUED EMAILS\n";
$queued = DataObject::get('QueuedEmail', "\"Send\" < " . DB::getConn()->now());
if( !$queued )
return;
foreach( $queued as $data ) {
if( !$data->canSendEmail() )
continue;
$data->send();
echo 'Sent to: ' . $data->To()->Email . "\n";
$data->delete();
}
}
}
?>