Yioop_V9.5_Source_Code_Documentation

BulkEmailJob extends MediaJob
in package

MediaJob class for sending out emails from a Yioop instance (either in response to account registrations or in response to group posts and similar activities)

Table of Contents

$controller  : object
If MediaJob was instantiated in the web app, the controller that instatiated it
$mail_server  : object
Mail Server object used to send mails from media updater
$media_updater  : object
If the MediaJob was instantiated in a MediaUpdater, this is a reference to that updater
$name_server_does_client_tasks  : bool
Whether to run the job's client tasks on the name server in addition to prepareTasks and finishTasks
$name_server_does_client_tasks_only  : bool
Whether this MediaJob performs name server only tasks
$tasks  : array<string|int, mixed>
The most recently received from the name server tasks for this MediaJob
__construct()  : mixed
Instiates the MediaJob with a reference to the object that instatiated it
checkPrerequisites()  : true
Bulk mail runs if the media updater is in distributed mode or if Yioop configured to send mail from media updater
doTasks()  : mixed
Emails a list of emails provided by the name server to the media updater client
execNameServer()  : array<string|int, mixed>
Executes a method on the name server's JobController.
finishTasks()  : mixed
This method is called on the name server to finish processing any data returned by MediaUpdater clients.
getCurrentMachine()  : string
Returns a hash of the url of the current machine based on the value saved to self::current_machine_info_file by a machine statuses request
getJobName()  : string
Gets the class name (less namespace and the word Job ) of the current MediaJob
getTasks()  : array<string|int, mixed>
Handles the request to get the mailer list file for sending emails. This selection is based upon if the file was taken previously or not. If it was then it is skipped.
init()  : mixed
Set up the MailServer object used to actually send mail
nondistributedTasks()  : mixed
Function to send emails to mailer batches created by mail_server. This function would periodically be invoked and send emails reading data from the text files.
prepareTasks()  : mixed
This method is called on the name server to prepare data for any MediaUpdater clients.
putTasks()  : array<string|int, mixed>
After a MediaUpdater client is done with the task given to it by the name server's media updater, the client contact the name server's web app. The name servers web app's JobController then calls this method to receive the data on the name server
run()  : mixed
Method executed by MediaUpdater to perform the MediaJob. This method shouldn't need to be overridden. Instead, the various callbacks it calls (listed in the class description) wshould be overridden.

Properties

$controller

If MediaJob was instantiated in the web app, the controller that instatiated it

public object $controller

$mail_server

Mail Server object used to send mails from media updater

public object $mail_server

$media_updater

If the MediaJob was instantiated in a MediaUpdater, this is a reference to that updater

public object $media_updater

$name_server_does_client_tasks

Whether to run the job's client tasks on the name server in addition to prepareTasks and finishTasks

public bool $name_server_does_client_tasks

$name_server_does_client_tasks_only

Whether this MediaJob performs name server only tasks

public bool $name_server_does_client_tasks_only

$tasks

The most recently received from the name server tasks for this MediaJob

public array<string|int, mixed> $tasks

Methods

__construct()

Instiates the MediaJob with a reference to the object that instatiated it

public __construct([object $media_updater = null ][, object $controller = null ]) : mixed
Parameters
$media_updater : object = null

a reference to the media updater that instatiated this object (if being run in MediaUpdater)

$controller : object = null

a reference to the controller that instantiated this object (if being run in the web app)

Return values
mixed

checkPrerequisites()

Bulk mail runs if the media updater is in distributed mode or if Yioop configured to send mail from media updater

public checkPrerequisites() : true
Return values
true

if bulk mail task should be run.

doTasks()

Emails a list of emails provided by the name server to the media updater client

public doTasks(array<string|int, mixed> $tasks) : mixed
Parameters
$tasks : array<string|int, mixed>

contains emails which should be sent out

Return values
mixed

data to send back to name server (in this case the name of the email file that was completely sent)

execNameServer()

Executes a method on the name server's JobController.

public static execNameServer(string $command[, string $args = null ]) : array<string|int, mixed>

It will typically execute either getTask or putTask for a specific Mediajob or getUpdateProperties to find out the current MediaUpdater should be configured.

Parameters
$command : string

the method to invoke on the name server

$args : string = null

additional arguments to be passed to the name server

Return values
array<string|int, mixed>

data returned by the name server.

finishTasks()

This method is called on the name server to finish processing any data returned by MediaUpdater clients.

public finishTasks() : mixed
Return values
mixed

getCurrentMachine()

Returns a hash of the url of the current machine based on the value saved to self::current_machine_info_file by a machine statuses request

public static getCurrentMachine() : string
Return values
string

hash of current machine url

getJobName()

Gets the class name (less namespace and the word Job ) of the current MediaJob

public static getJobName() : string
Return values
string

name of the current job

getTasks()

Handles the request to get the mailer list file for sending emails. This selection is based upon if the file was taken previously or not. If it was then it is skipped.

public getTasks(int $machine_id[, array<string|int, mixed> $data = null ]) : array<string|int, mixed>

Otherwise new file is sent for sending emails and new text file with taken prepended to the file name is generated.

Parameters
$machine_id : int

id of client requesting data (not used)

$data : array<string|int, mixed> = null

not used

Return values
array<string|int, mixed>

work for the client to process

init()

Set up the MailServer object used to actually send mail

public init() : mixed
Return values
mixed

nondistributedTasks()

Function to send emails to mailer batches created by mail_server. This function would periodically be invoked and send emails reading data from the text files.

public nondistributedTasks() : mixed
Return values
mixed

prepareTasks()

This method is called on the name server to prepare data for any MediaUpdater clients.

public prepareTasks() : mixed
Return values
mixed

putTasks()

After a MediaUpdater client is done with the task given to it by the name server's media updater, the client contact the name server's web app. The name servers web app's JobController then calls this method to receive the data on the name server

public putTasks(int $machine_id, mixed $data) : array<string|int, mixed>
Parameters
$machine_id : int

id of client that is sending data to name server

$data : mixed

results of computation done by client

Return values
array<string|int, mixed>

any response information to send back to the client

run()

Method executed by MediaUpdater to perform the MediaJob. This method shouldn't need to be overridden. Instead, the various callbacks it calls (listed in the class description) wshould be overridden.

public run() : mixed
Return values
mixed

        

Search results