$controller
$controller : object
If MediaJob was instantiated in the web app, the controller that instatiated it
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)
Subclasses should implement methods they use among init(), checkPrerequisites(), nondistributedTasks(), prepareTasks(), finishTasks(), getTasks(), doTasks(), and putTask(). MediaUpdating can be configured to run in either distributed or nameserver only mode. In the former mode, prepareTasks(), finishTasks() run on the name server, getTasks() and putTask() run in the name server's web app, and doTasks() run on any MediaUpdater clients. In the latter mode, only the method nondistributedTasks() is called by the MediaUpdater and by only the updater on the name server.
__construct(object $media_updater = null, object $controller = null)
Instiates the MediaJob with a reference to the object that instatiated it
object | $media_updater | a reference to the media updater that instatiated this object (if being run in MediaUpdater) |
object | $controller | a reference to the controller that instantiated this object (if being run in the web app) |
doTasks(array $tasks) : mixed
Emails a list of emails provided by the name server to the media updater client
array | $tasks | contains emails which should be sent out |
data to send back to name server (in this case the name of the email file that was completely sent)
getTasks(integer $machine_id, array $data = null) : array
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.
Otherwise new file is sent for sending emails and new text file with taken prepended to the file name is generated.
integer | $machine_id | id of client requesting data (not used) |
array | $data | not used |
work for the client to process
putTasks(integer $machine_id, mixed $data) : array
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
integer | $machine_id | id of client that is sending data to name server |
mixed | $data | results of computation done by client |
any response information to send back to the client
execNameServer(string $command, string $args = null) : array
Executes a method on the name server's JobController.
It will typically execute either getTask or putTask for a specific Mediajob or getUpdateProperties to find out the current MediaUpdater should be configured.
string | $command | the method to invoke on the name server |
string | $args | additional arguments to be passed to the name server |
data returned by the name server.