Yioop_V9.5_Source_Code_Documentation

TrendingHighlightsJob extends MediaJob
in package

A media job to compute trending terms from the feed search sources, and to generate a list of top feed items for the landing page for the different subsearches displlayed on the landing page.

Table of Contents

MAX_VALUES_ONE_GO  = 100
Mamimum number of trending values to download in one try
$controller  : object
If MediaJob was instantiated in the web app, the controller that instatiated it
$db  : object
Datasource object used to run db queries related to fes items (for storing and updating them)
$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
$update_time  : int
Time in current epoch when feeds last updated
__construct()  : mixed
Instiates the MediaJob with a reference to the object that instatiated it
checkPrerequisites()  : bool
Only update if its been more than an hour since the last update
computeLandingHighlights()  : mixed
Computes arrays of data used to display the news and trending highlights on the search landing page. Saves these precomputed arrays to C\TRENDS_DIR under a file for each locale
doTasks()  : mixed
This method is run on MediaUpdater client with data gotten from the name server by getTasks. The idea is the client is supposed to then this information and if need be send the results back to the name server
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>
Method called from JobController when a MediaUpdater client contacts the name server's web app. This method is supposed to marshal any data on the name server that the requesting client should process.
init()  : mixed
Initializes the last update time to far in the past so, feeds will get immediately updated. Sets up connect to DB to store feeds items, and makes it so the same media job runs both on name server and client Media Updaters
nondistributedTasks()  : mixed
For now trending values only computed on Namesevers (as specific to the database there) so is done in prepareTasks
prepareTasks()  : mixed
(Run on name server)
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.
updateTrendingValuesOneGo()  : mixed
For each of a supplied list of podcast associative arrays, downloads the non-expired media for that podcast to the wiki folder specified.

Constants

MAX_VALUES_ONE_GO

Mamimum number of trending values to download in one try

public mixed MAX_VALUES_ONE_GO = 100

Properties

$controller

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

public object $controller

$db

Datasource object used to run db queries related to fes items (for storing and updating them)

public object $db

$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()

Only update if its been more than an hour since the last update

public checkPrerequisites() : bool
Return values
bool

whether its been an hour since the last update

computeLandingHighlights()

Computes arrays of data used to display the news and trending highlights on the search landing page. Saves these precomputed arrays to C\TRENDS_DIR under a file for each locale

public computeLandingHighlights() : mixed
Return values
mixed

doTasks()

This method is run on MediaUpdater client with data gotten from the name server by getTasks. The idea is the client is supposed to then this information and if need be send the results back to the name server

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

data that the MediaJob running on a client MediaUpdater needs to process

Return values
mixed

the result of carrying out that processing

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()

Method called from JobController when a MediaUpdater client contacts the name server's web app. This method is supposed to marshal any data on the name server that the requesting client should process.

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

id of client requesting data

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

any additional info about data being requested

Return values
array<string|int, mixed>

work for the client to process

init()

Initializes the last update time to far in the past so, feeds will get immediately updated. Sets up connect to DB to store feeds items, and makes it so the same media job runs both on name server and client Media Updaters

public init() : mixed
Return values
mixed

nondistributedTasks()

For now trending values only computed on Namesevers (as specific to the database there) so is done in prepareTasks

public nondistributedTasks() : 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

updateTrendingValuesOneGo()

For each of a supplied list of podcast associative arrays, downloads the non-expired media for that podcast to the wiki folder specified.

public updateTrendingValuesOneGo(array<string|int, mixed> $trending_sites[, int $age = CONE_WEEK ][, bool $test_mode = false ]) : mixed
Parameters
$trending_sites : array<string|int, mixed>

an array of associative arrays of info about values to download

$age : int = CONE_WEEK

oldest age items to consider for download

$test_mode : bool = false

if true then rather then updating items in wiki, returns as a string summarizing the results of the downloads that would occur as part of updating the podcast

Return values
mixed

either true, or if $test_mode is true then the results as a string of the operations involved in downloading the podcasts


        

Search results