ultimix
schedule_1_0_0 Class Reference

Public Member Functions

 __construct ()
 run_task ($Parameters, $CurrentIteration)
 run_single_task ($Task)
 run_all_tasks ($Tasks)
 run_tasks ()

Data Fields

 $Database = false
 $String = false
 $Settings = false
 $ScheduleAccess = false
 $ScheduleAlgorithms = false

Detailed Description

Class for processing schedule tasks.

Author
Dodonov A.A.

Definition at line 38 of file schedule.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 70 of file schedule.php.

{
try
{
$this->Database = get_package( 'database' , 'last' , __FILE__ );
$this->String = get_package( 'string' , 'last' , __FILE__ );
$this->Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$this->ScheduleAccess = get_package( 'schedule::schedule_access' , 'last' , __FILE__ );
$this->ScheduleAlgorithms = get_package( 'schedule::schedule_algorithms' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

run_all_tasks (   $Tasks)

Function processes tasks in the queue.

Parameters
$Tasks- All tasks.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 270 of file schedule.php.

{
try
{
$Ids = implode_ex( ',' , $Tasks , 'id' );
$this->ScheduleAccess->update( $Ids , array( 'processing' => 1 ) );
$this->Database->unlock();
foreach( $Tasks as $k => $Task )
{
$this->run_single_task( $Task );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_single_task (   $Task)

Function processes task.

Parameters
$Task- Task.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 235 of file schedule.php.

{
try
{
$NextIteration = $this->call_run_task_function( $Task );
$this->finish_task_processing( $Task , $NextIteration );
}
catch( Exception $e )
{
$this->Database->unlock();/* clear all locks if the exception was caught */
$this->ScheduleAccess->update( $Task->id , array( 'processing' => 0 ) );
$this->Database->commit();
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_task (   $Parameters,
  $CurrentIteration 
)

Function processes task.

Parameters
$Parameters- parameters of the task processing.
$CurrentIteration- current interation.
Returns
Next iteration.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 112 of file schedule.php.

{
try
{
$this->Settings->load_settings( $Parameters );
if( $this->Settings->get_setting( 'cron_ping' , '0' ) == 1 )
{
print( 'Cron ping' );
return( $CurrentIteration + 1 );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
run_tasks ( )

Function processes tasks in the queue.

Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 303 of file schedule.php.

{
try
{
$this->Database->lock( array( 'umx_schedule' ) , array( 'WRITE' ) );
$this->Settings->load_file( dirname( __FILE__ ).'/conf/cf_schedule_settings' );
$Tasks = $this->ScheduleAlgorithms->get_tasks(
$this->Settings->get_setting( 'processing_tasks_count' , 10 )
);
if( isset( $Tasks[ 0 ] ) )
{
$this->run_all_tasks( $Tasks );
}
else
{
$this->Database->unlock();
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$Database = false

Cached objects.

Author
Dodonov A.A.

Definition at line 50 of file schedule.php.

$ScheduleAccess = false

Definition at line 53 of file schedule.php.

$ScheduleAlgorithms = false

Definition at line 54 of file schedule.php.

$Settings = false

Definition at line 52 of file schedule.php.

$String = false

Definition at line 51 of file schedule.php.


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