Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
Bulk_Mailer Class Reference

Public Member Functions

 __construct ()
 
 start ()
 
 fork ()
 
 chunkJob ($job_id)
 
 processJob ($job_id)
 
 _reconnectDB ($dbsearch=FALSE)
 
 updateProgress ($progress_path, $user_id, $problematic, $filtered)
 
 nextChunk ($progress_path)
 
 getAllRecipients ($asset_to_send_id, $recipients)
 
 generateContent ($job_details, $job_path, $recipient_id=NULL, $email=NULL)
 
 calculateChunkSize ($thresholds, $progress_path)
 
 enforceSendRate ($thresholds, $progress_path)
 
 checkThreshold ($type, $thresholds, $extra='')
 
 isExcludedTime ($thresholds)
 
 checkTimeOut ($thresholds, $progress_info)
 
 _sigHandler ($signo)
 
 _errorHandler ($err_no, $err_msg, $err_file, $err_line)
 

Static Public Member Functions

static generateRawContent ($details)
 
static replaceContentKeywords (&$content, &$user)
 

Data Fields

 $error_log_file_name = 'bulkmail_errors'
 

Detailed Description

Definition at line 32 of file bulk_mailer.inc.

Constructor & Destructor Documentation

__construct ( )

Constructor

Definition at line 42 of file bulk_mailer.inc.

Member Function Documentation

_errorHandler (   $err_no,
  $err_msg,
  $err_file,
  $err_line 
)

This function captures all errors and warnings that occur during the execution of start()

Parameters
int$err_noThe type of error (E_*)
string$err_msgThe error message
string$err_fileThe file the error occured in
string$err_lineThe line the error occured on
Returns
void private
See Also
Cron_Manager::_errorHandler()

Definition at line 1312 of file bulk_mailer.inc.

_reconnectDB (   $dbsearch = FALSE)

Reconnects to the DB as child process disconnects DB when it exits

Returns
void private

Definition at line 640 of file bulk_mailer.inc.

_sigHandler (   $signo)

Signal handler for the pcntl fork process

Parameters
int$signothe signals that are supported by the PHP Process Control functions
Returns
void private

Definition at line 1286 of file bulk_mailer.inc.

calculateChunkSize (   $thresholds,
  $progress_path 
)

Calculate the recipient chunk size based on the 'send rate' threshold

Parameters
array$thresholdsthe threshold attribute of the post office
string$progress_paththe progress path of the job
Returns
boolean public

Definition at line 1084 of file bulk_mailer.inc.

checkThreshold (   $type,
  $thresholds,
  $extra = '' 
)

Checks a particular threshold rule

Parameters
string$typethe type of the thresholding rule to check
array$thresholdsthe threshold attribute of the post office
array$extraextra param that needs to be passed in
Returns
boolean public

Definition at line 1182 of file bulk_mailer.inc.

checkTimeOut (   $thresholds,
  $progress_info 
)

Check if a running job is timeout-ed

Parameters
array$thresholdsthe threshold attribute of the post office
array$progress_infothe current progress info from the progress file
Returns
boolean public

Definition at line 1261 of file bulk_mailer.inc.

chunkJob (   $job_id)

Cache recipients into chunks using a fork process

Parameters
int$job_idthe unique id of the job entry
Returns
void public

Definition at line 160 of file bulk_mailer.inc.

enforceSendRate (   $thresholds,
  $progress_path 
)

Apply the send rate rule by putting the script to sleep after each recipient

Parameters
array$thresholdsthe threshold attribute of the post office
string$progress_paththe progress path of the job
Returns
boolean public

Definition at line 1130 of file bulk_mailer.inc.

fork ( )

Fork this server process

Returns
string public

Definition at line 131 of file bulk_mailer.inc.

generateContent (   $job_details,
  $job_path,
  $recipient_id = NULL,
  $email = NULL 
)

Generates the html bulkmail content based on the user and content generation type

Used in previewing mail and sending actual bmail (use each user or one user) Pre-selected user is used when we cannot login bulkmail_users

Parameters
array$job_detailsDetails of the job
string$job_pathpath to the effective job data dir
int$recipient_idthe recipient of this email, empty is for preview mail
array$emailthe email of the recipient (or the email details), empty is for preview mail
Returns
string public

Definition at line 897 of file bulk_mailer.inc.

static generateRawContent (   $details)
static

Generate the raw content to be sent, ignoring user switching and recpient keyword replacement

Parameters
array$detailsThe details of the job
Returns
string private

Definition at line 1012 of file bulk_mailer.inc.

getAllRecipients (   $asset_to_send_id,
  $recipients 
)

Cache all recipients (user_id => email) for a job

Warning: $result array can be huge Expands user_group to get all user/bulkmail_user Skips those recipients that is in .queue or .sent directory

Parameters
int$asset_to_send_idthe id of the asset to send
array$recipientsthe job's 'recipients' attribute stripped from vars
Returns
array public

Definition at line 751 of file bulk_mailer.inc.

isExcludedTime (   $thresholds)

Check if current time is within excluded time threshold rule

Parameters
array$thresholdsthe threshold attribute of the post office
Returns
boolean public

Definition at line 1210 of file bulk_mailer.inc.

nextChunk (   $progress_path)

Proceed to next recipient chunk

Parameters
string$progress_pathpath to the progress info file
Returns
boolean public

Definition at line 709 of file bulk_mailer.inc.

processJob (   $job_id)

Process the active bulkmail job

Parameters
int$job_idthe unique id of the job entry
Returns
boolean public

Definition at line 213 of file bulk_mailer.inc.

static replaceContentKeywords ( $content,
$user 
)
static

Keyword replacement for customised email content of a user

Parameters
string&$contentpage content before keyword replacement
int&$userpersonalise content for this user
Returns
string public

Definition at line 1029 of file bulk_mailer.inc.

start ( )

Starts the process, gets called from run.php

Returns
array public

Definition at line 54 of file bulk_mailer.inc.

updateProgress (   $progress_path,
  $user_id,
  $problematic,
  $filtered 
)

Writes the progress info to a file after a mail has been added to the queue

If a user was both problematic AND filtered (probable if enabled), it will be marked as the former.

Parameters
string$progress_pathpath to the progress info file
int$user_idcurrent recipient assetid
boolean$problematicTRUE means we couldn't generate bmail for this user
boolean$filteredTRUE means user's bmail was filtered out
Returns
boolean public

Definition at line 669 of file bulk_mailer.inc.


The documentation for this class was generated from the following file: