Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

API CHANGE Removed unused QueuedEmail and QueuedEmailDispatchTask

  • Loading branch information...
commit 59230d8e39fe3837c24d8e7248117892af604313 1 parent b1f27b4
@chillu chillu authored
Showing with 0 additions and 68 deletions.
  1. +0 −36 email/QueuedEmail.php
  2. +0 −32 email/QueuedEmailDispatchTask.php
View
36 email/QueuedEmail.php
@@ -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
32 email/QueuedEmailDispatchTask.php
@@ -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();
- }
- }
-
-}
-?>
Please sign in to comment.
Something went wrong with that request. Please try again.