ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCronCheck Class Reference
+ Collaboration diagram for ilCronCheck:

Public Member Functions

 __construct ()
 
 start ()
 

Private Member Functions

 runTask ($task)
 
 initTasks ()
 

Private Attributes

 $possible_tasks = array()
 
 $default_tasks = array()
 

Detailed Description

Definition at line 34 of file class.ilCronCheck.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronCheck::__construct ( )

Definition at line 39 of file class.ilCronCheck.php.

References $ilLog, and initTasks().

40  {
41  global $ilLog;
42 
43  $this->log = $ilLog;
44 
45  $this->initTasks();
46  }
+ Here is the call graph for this function:

Member Function Documentation

◆ initTasks()

ilCronCheck::initTasks ( )
private

Definition at line 131 of file class.ilCronCheck.php.

References $ilSetting, and array.

Referenced by __construct().

132  {
133  global $ilSetting;
134 
135  $this->default_tasks = array(
136  'ilCronValidator::check'
137  );
138 
139  $this->possible_tasks = array(
140 
141  // Start System Check
142  'ilCronValidator::check' => array(
143  'classname' => 'ilCronValidator',
144  'method' => 'check',
145  'location' => 'cron',
146  'condition' => ($ilSetting->get('systemcheck_cron') == 1)
147  )
148  );
149  }
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ runTask()

ilCronCheck::runTask (   $task)
private

prepare task information

check if task is runable

run task

Definition at line 77 of file class.ilCronCheck.php.

References $ilLog.

Referenced by start().

78  {
79  global $ilLog;
80 
85  $classlocation = $task['location'] . '/classes';
86  if (isset($task['sub_location']) && strlen($task['sub_location'])) {
87  $classlocation .= '/' . $task['sub_location'];
88  }
89  $classfile .= $classlocation . '/class.' . $task['classname'] . '.php';
90 
91  $classname = $task['classname'];
92  $method = $task['method'];
93 
94  $condition = $task['condition'];
95 
100  if (!file_exists($classfile)) {
101  throw new ilException('class file "' . $classfile . '" does not exist');
102  }
103 
104  require_once($classfile);
105 
106  if (!class_exists($classname)) {
107  throw new ilException('class "' . $classname . '" does not exist');
108  }
109 
110  if (!method_exists($classname, $method)) {
111  throw new ilException('method "' . $classname . '::' . $method . '()" does not exist');
112  }
113 
119  if ($condition) {
120  $ilLog->write("CRON - starting task: " . $classname . "::" . $method);
121 
122  $task = new $classname;
123  $task->$method();
124 
125  $ilLog->write("CRON - finished task: " . $classname . "::" . $method);
126  } else {
127  $ilLog->write("CRON - task condition failed: " . $classname . "::" . $method);
128  }
129  }
+ Here is the caller graph for this function:

◆ start()

ilCronCheck::start ( )

Definition at line 48 of file class.ilCronCheck.php.

References $_SERVER, $i, and runTask().

49  {
50  /* MOVED TO: ilCronManager::runActiveJobs();
51  global $ilSetting;
52 
53  $ilSetting->set('last_cronjob_start_ts', time());
54  */
55 
56  if ($_SERVER['argc'] > 4) {
57  for ($i = 4; $i < $_SERVER['argc']; $i++) {
58  $arg = $_SERVER['argv'][$i];
59 
60  if (!isset($this->possible_tasks[$arg])) {
61  throw new ilException('cron-task "' . $arg . '" is not defined');
62  }
63 
64  $task = $this->possible_tasks[$arg];
65 
66  $this->runTask($task);
67  }
68  } else {
69  foreach ($this->default_tasks as $task) {
70  $task = $this->possible_tasks[$task];
71 
72  $this->runTask($task);
73  }
74  }
75  }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

Field Documentation

◆ $default_tasks

ilCronCheck::$default_tasks = array()
private

Definition at line 37 of file class.ilCronCheck.php.

◆ $possible_tasks

ilCronCheck::$possible_tasks = array()
private

Definition at line 36 of file class.ilCronCheck.php.


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