ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSCTreeTasks Class Reference

Defines a system check task. More...

+ Collaboration diagram for ilSCTreeTasks:

Public Member Functions

 __construct (ilSCTask $task)
 
 getDB ()
 
 getTask ()
 
 validateStructure ()
 validate tree structure base on parent relation More...
 
 checkStructure ()
 
 validateDuplicates ()
 
 checkDuplicates ()
 Check for duplicates. More...
 
 findMissingTreeEntries ()
 
 findMissing ()
 Find missing objects. More...
 
 repairMissing ()
 Repair missing objects. More...
 
 repairMissingTreeEntries ()
 repair missing tree entries type $ilDB More...
 

Static Public Member Functions

static findDeepestDuplicate ()
 find duplicates type $ilDB More...
 
static repairPK ()
 
static getNodeInfo ($a_tree_id, $a_child)
 
static getChilds ($a_tree_id, $a_childs)
 
static findDuplicates ($a_duplicate_id)
 find duplicates type $ilDB More...
 
static hasDuplicate ($a_child)
 
static deleteDuplicateFromTree ($a_duplicate_id, $a_delete_trash)
 

Protected Member Functions

 repairMissingObject ($a_parent_ref, $a_ref_id)
 Repair missing object. More...
 
 readMissing ()
 Read missing objects in tree Entry in oject_reference but no entry in tree type $ilDB. More...
 
 deleteMissingTreeEntry ($a_tree_id, $a_ref_id)
 Delete missing tree entries from tree table. More...
 
 readMissingTreeEntries ()
 Read missing tree entries for referenced objects Entry in tree but no entry in object reference type $ilDB. More...
 
 createRecoveryContainer ()
 Create a reccovery folder. More...
 

Static Protected Member Functions

static deleteDuplicate ($tree_id, $dup_id)
 

Private Attributes

 $db = null
 
 $task = null
 

Detailed Description

Defines a system check task.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 9 of file class.ilSCTreeTasks.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCTreeTasks::__construct ( ilSCTask  $task)

Definition at line 14 of file class.ilSCTreeTasks.php.

References $GLOBALS, and $task.

15  {
16  $this->db = $GLOBALS['ilDB'];
17  $this->task = $task;
18  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

Member Function Documentation

◆ checkDuplicates()

ilSCTreeTasks::checkDuplicates ( )

Check for duplicates.

Definition at line 270 of file class.ilSCTreeTasks.php.

References $GLOBALS, $query, $res, $row, array, ilDBConstants\FETCHMODE_OBJECT, and getDB().

Referenced by validateDuplicates().

271  {
272  $query = 'SELECT child, count(child) num FROM tree '.
273  'GROUP BY child '.
274  'HAVING count(child) > 1';
275  $res = $this->getDB()->query($query);
276 
277  $GLOBALS['ilLog']->write($query);
278 
279  $failures = array();
280  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
281  {
282  $failures[] = $row->child;
283  }
284  return $failures;
285  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkStructure()

ilSCTreeTasks::checkStructure ( )

Definition at line 225 of file class.ilSCTreeTasks.php.

References $GLOBALS, $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by validateStructure().

226  {
227  return $GLOBALS['tree']->validateParentRelations();
228  global $ilDB;
229 
230  $query = 'select child from tree child where not exists '.
231  '( '.
232  'select child from tree parent where child.parent = parent.child and (parent.lft < child.lft) and (parent.rgt > child.rgt) '.
233  ')'.
234  'and tree = 1 and child <> 1';
235  $res = $ilDB->query($query);
236 
237  $failures = array();
238  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
239  {
240  $failures[] = $row->child;
241  }
242  return $failures;
243  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ createRecoveryContainer()

ilSCTreeTasks::createRecoveryContainer ( )
protected

Create a reccovery folder.

Definition at line 516 of file class.ilSCTreeTasks.php.

References IL_CAL_DATETIME, IL_CAL_UNIX, and time.

Referenced by repairMissing().

517  {
518  $now = new ilDateTime(time(),IL_CAL_UNIX);
519 
520  include_once './Modules/Folder/classes/class.ilObjFolder.php';
521  $folder = new ilObjFolder();
522  $folder->setTitle('__System check recovery: '.$now->get(IL_CAL_DATETIME));
523  $folder->create();
524  $folder->createReference();
525  $folder->putInTree(RECOVERY_FOLDER_ID);
526 
527  return $folder->getRefId();
528  }
Class ilObjFolder.
const IL_CAL_DATETIME
const IL_CAL_UNIX
Date and time handling
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ deleteDuplicate()

static ilSCTreeTasks::deleteDuplicate (   $tree_id,
  $dup_id 
)
staticprotected

Definition at line 160 of file class.ilSCTreeTasks.php.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

161  {
162  global $ilDB;
163 
164  $query = 'SELECT child FROM tree '.
165  'WHERE parent = '.$ilDB->quote($dup_id,'integer').' '.
166  'AND tree = '.$ilDB->quote($tree_id,'integer');
167  $res = $ilDB->query($query);
168  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
169  {
170  // start recursion
171  self::deleteDuplicate($tree_id, $row->child);
172  }
173  // now delete node
174  if(self::hasDuplicate($dup_id))
175  {
176  $query = 'DELETE FROM tree '.
177  'WHERE child = '.$ilDB->quote($dup_id,'integer').' '.
178  'AND tree = '.$ilDB->quote($tree_id,'integer');
179  $ilDB->manipulate($query);
180  }
181  }
global $ilDB

◆ deleteDuplicateFromTree()

static ilSCTreeTasks::deleteDuplicateFromTree (   $a_duplicate_id,
  $a_delete_trash 
)
static

Definition at line 143 of file class.ilSCTreeTasks.php.

Referenced by ilSCTreeTasksGUI\deleteDuplicatesFromRepository(), and ilSCTreeTasksGUI\deleteDuplicatesFromTrash().

144  {
145  $dups = self::findDuplicates($a_duplicate_id);
146  foreach($dups as $dup)
147  {
148  if($a_delete_trash and $dup['tree'] < 1)
149  {
150  self::deleteDuplicate($dup['tree'],$dup['child']);
151  }
152  if(!$a_delete_trash and $dup['tree'] == 1)
153  {
154  self::deleteDuplicate($dup['tree'],$dup['child']);
155  }
156  }
157  return TRUE;
158  }
+ Here is the caller graph for this function:

◆ deleteMissingTreeEntry()

ilSCTreeTasks::deleteMissingTreeEntry (   $a_tree_id,
  $a_ref_id 
)
protected

Delete missing tree entries from tree table.

Definition at line 450 of file class.ilSCTreeTasks.php.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by repairMissingTreeEntries().

451  {
452  global $ilDB;
453 
454  $query = 'SELECT child FROM tree '.
455  'WHERE parent = '.$ilDB->quote($a_ref_id,'integer').' '.
456  'AND tree = '.$ilDB->quote($a_tree_id,'integer');
457 
458  $res = $ilDB->query($query);
459  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
460  {
461  // check for duplicates
462  $query = 'SELECT tree, child FROM tree '.
463  'WHERE child = '.$ilDB->quote($row->child);
464  $resd = $ilDB->query($query);
465  while($rowd = $resd->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
466  {
467  $this->deleteMissingTreeEntry($rowd->tree,$rowd->child);
468  }
469  }
470 
471  // finally delete
472  include_once './Services/Object/classes/class.ilObjectFactory.php';
473  $factory = new ilObjectFactory();
474  $ref_obj = $factory->getInstanceByRefId($a_ref_id,FALSE);
475 
476  if(($ref_obj instanceof ilObject) and $ref_obj->getType())
477  {
478  $ref_obj->delete();
479  }
480 
481  $query = 'DELETE from tree '.
482  'WHERE tree = '.$ilDB->quote($a_tree_id).' '.
483  'AND child = '.$ilDB->quote($a_ref_id);
484  $ilDB->manipulate($query);
485  }
Class ilObjectFactory.
Class ilObject Basic functions for all objects.
deleteMissingTreeEntry($a_tree_id, $a_ref_id)
Delete missing tree entries from tree table.
global $ilDB
+ Here is the caller graph for this function:

◆ findDeepestDuplicate()

static ilSCTreeTasks::findDeepestDuplicate ( )
static

find duplicates type $ilDB

Returns
int

Definition at line 26 of file class.ilSCTreeTasks.php.

References $GLOBALS, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSCTreeTasksGUI\repairDuplicates().

27  {
28  global $ilDB;
29 
30  $query = 'SELECT child FROM tree first '.
31  'WHERE EXISTS ( '.
32  'SELECT child FROM tree second WHERE first.child = second.child '.
33  'GROUP BY child HAVING COUNT(child) > 1 ) '.
34  'ORDER BY depth DESC';
35 
36  $GLOBALS['ilLog']->write($query);
37 
38  $res = $ilDB->query($query);
39  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
40  {
41  return $row->child;
42  }
43  return 0;
44  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilDB
+ Here is the caller graph for this function:

◆ findDuplicates()

static ilSCTreeTasks::findDuplicates (   $a_duplicate_id)
static

find duplicates type $ilDB

Returns
type

Definition at line 108 of file class.ilSCTreeTasks.php.

References $GLOBALS, $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSCTreeDuplicatesTableGUI\fillRow().

109  {
110  global $ilDB;
111 
112  $query = 'SELECT * FROM tree first '.
113  'WHERE EXISTS ( '.
114  'SELECT child FROM tree second WHERE first.child = second.child '.
115  'GROUP BY child HAVING COUNT(child) > 1 ) '.
116  'AND child = '.$ilDB->quote($a_duplicate_id,'integer').' '.
117  'ORDER BY depth DESC';
118  $res = $ilDB->query($query);
119 
120  $GLOBALS['ilLog']->write($query);
121 
122  $nodes = array();
123  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
124  {
125  $node = array();
126  $node['tree'] = $row->tree;
127  $node['child'] = $row->child;
128  $node['depth'] = $row->depth;
129 
130  $nodes[] = $node;
131  }
132 
133  return $nodes;
134  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ findMissing()

ilSCTreeTasks::findMissing ( )

Find missing objects.

Definition at line 311 of file class.ilSCTreeTasks.php.

References $ilDB, getTask(), IL_CAL_UNIX, readMissing(), ilSCTask\STATUS_COMPLETED, ilSCTask\STATUS_FAILED, and time.

312  {
313  global $ilDB;
314 
315  $failures = $this->readMissing();
316 
317  if(count($failures))
318  {
319  $this->getTask()->setStatus(ilSCTask::STATUS_FAILED);
320  }
321  else
322  {
323  $this->getTask()->setStatus(ilSCTask::STATUS_COMPLETED);
324  }
325 
326  $this->getTask()->setLastUpdate(new ilDateTime(time(),IL_CAL_UNIX));
327  $this->getTask()->update();
328  return count($failures);
329 
330  }
const STATUS_FAILED
const IL_CAL_UNIX
Date and time handling
const STATUS_COMPLETED
readMissing()
Read missing objects in tree Entry in oject_reference but no entry in tree type $ilDB.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ findMissingTreeEntries()

ilSCTreeTasks::findMissingTreeEntries ( )

Definition at line 287 of file class.ilSCTreeTasks.php.

References $ilDB, getTask(), IL_CAL_UNIX, readMissingTreeEntries(), ilSCTask\STATUS_COMPLETED, ilSCTask\STATUS_FAILED, and time.

288  {
289  global $ilDB;
290 
291  $failures = $this->readMissingTreeEntries();
292 
293  if(count($failures))
294  {
295  $this->getTask()->setStatus(ilSCTask::STATUS_FAILED);
296  }
297  else
298  {
299  $this->getTask()->setStatus(ilSCTask::STATUS_COMPLETED);
300  }
301 
302  $this->getTask()->setLastUpdate(new ilDateTime(time(),IL_CAL_UNIX));
303  $this->getTask()->update();
304  return count($failures);
305  }
readMissingTreeEntries()
Read missing tree entries for referenced objects Entry in tree but no entry in object reference type...
const STATUS_FAILED
const IL_CAL_UNIX
Date and time handling
const STATUS_COMPLETED
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ getChilds()

static ilSCTreeTasks::getChilds (   $a_tree_id,
  $a_childs 
)
static

Definition at line 88 of file class.ilSCTreeTasks.php.

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSCTreeDuplicatesTableGUI\fillRow().

89  {
90  global $ilDB;
91 
92  $query = 'SELECT * FROM tree WHERE tree = '.$ilDB->quote($a_tree_id,'integer').' '.'AND child = '.$ilDB->quote($a_childs,'integer');
93  $res = $ilDB->query($query);
94 
95  $childs = array();
96  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
97  {
98  $childs[] = $row->child;
99  }
100  return $childs;
101  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getDB()

ilSCTreeTasks::getDB ( )
Returns
ilDB

Definition at line 187 of file class.ilSCTreeTasks.php.

References $db.

Referenced by checkDuplicates().

188  {
189  return $this->db;
190  }
+ Here is the caller graph for this function:

◆ getNodeInfo()

static ilSCTreeTasks::getNodeInfo (   $a_tree_id,
  $a_child 
)
static

Definition at line 52 of file class.ilSCTreeTasks.php.

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSCTreeDuplicatesTableGUI\fillObjectRow().

53  {
54  global $ilDB;
55 
56  $query = 'SELECT * FROM tree WHERE child = '.$ilDB->quote($a_child,'integer').' AND tree = '. $ilDB->quote($a_tree_id,'integer');
57  $res = $ilDB->query($query);
58 
59  $node = array();
60  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
61  {
62  $node['child'] = $row->child;
63  $node['tree'] = $row->tree;
64  $node['depth'] = $row->depth;
65 
66  // read obj_id
67  $query = 'SELECT obj_id FROM object_reference WHERE ref_id = '.$ilDB->quote($a_child,'integer');
68  $ref_res = $ilDB->query($query);
69  while($ref_row = $ref_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
70  {
71  $node['obj_id'] = $ref_row->obj_id;
72 
73  // read object info
74  $query = 'SELECT title, description, type FROM object_data '.
75  'WHERE obj_id = '.$ilDB->quote($ref_row->obj_id);
76  $obj_res = $ilDB->query($query);
77  while($obj_row = $obj_res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
78  {
79  $node['title'] = $obj_row->title;
80  $node['description'] = $obj_row->description;
81  $node['type'] = $obj_row->type;
82  }
83  }
84  }
85  return $node;
86  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getTask()

ilSCTreeTasks::getTask ( )
Returns
ilSCTask

Definition at line 196 of file class.ilSCTreeTasks.php.

References $task.

Referenced by findMissing(), findMissingTreeEntries(), validateDuplicates(), and validateStructure().

197  {
198  return $this->task;
199  }
+ Here is the caller graph for this function:

◆ hasDuplicate()

static ilSCTreeTasks::hasDuplicate (   $a_child)
static

Definition at line 136 of file class.ilSCTreeTasks.php.

References $ilDB.

137  {
138  global $ilDB;
139 
140  return count(self::findDuplicates($a_child));
141  }
global $ilDB

◆ readMissing()

ilSCTreeTasks::readMissing ( )
protected

Read missing objects in tree Entry in oject_reference but no entry in tree type $ilDB.

Returns
type

Definition at line 404 of file class.ilSCTreeTasks.php.

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by findMissing(), and repairMissing().

405  {
406  global $ilDB;
407 
408  $query = 'SELECT ref_id FROM object_reference '.
409  'LEFT JOIN tree ON ref_id = child '.
410  'WHERE child IS NULL';
411  $res = $ilDB->query($query);
412 
413  $failures = array();
414  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
415  {
416  $failures[] = $row->ref_id;
417  }
418  return $failures;
419  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ readMissingTreeEntries()

ilSCTreeTasks::readMissingTreeEntries ( )
protected

Read missing tree entries for referenced objects Entry in tree but no entry in object reference type $ilDB.

Returns
type

Definition at line 494 of file class.ilSCTreeTasks.php.

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by findMissingTreeEntries(), and repairMissingTreeEntries().

495  {
496  global $ilDB;
497 
498  $query = 'SELECT child FROM tree '.
499  'LEFT JOIN object_reference ON child = ref_id '.
500  'WHERE ref_id IS NULL';
501 
502  $res = $ilDB->query($query);
503 
504  $failures = array();
505  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
506  {
507  $failures[] = $row->child;
508  }
509  return $failures;
510  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ repairMissing()

ilSCTreeTasks::repairMissing ( )

Repair missing objects.

Definition at line 335 of file class.ilSCTreeTasks.php.

References $ref_id, createRecoveryContainer(), readMissing(), and repairMissingObject().

336  {
337  $failures = $this->readMissing();
338  $recf_ref_id = $this->createRecoveryContainer();
339  foreach($failures as $ref_id)
340  {
341  $this->repairMissingObject($recf_ref_id,$ref_id);
342  }
343 
344  }
repairMissingObject($a_parent_ref, $a_ref_id)
Repair missing object.
$ref_id
Definition: sahs_server.php:39
createRecoveryContainer()
Create a reccovery folder.
readMissing()
Read missing objects in tree Entry in oject_reference but no entry in tree type $ilDB.
+ Here is the call graph for this function:

◆ repairMissingObject()

ilSCTreeTasks::repairMissingObject (   $a_parent_ref,
  $a_ref_id 
)
protected

Repair missing object.

Parameters
type$a_parent_ref

Definition at line 350 of file class.ilSCTreeTasks.php.

References $GLOBALS, $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by repairMissing().

351  {
352  global $ilDB;
353 
354  // check if object entry exist
355  $query = 'SELECT obj_id FROM object_reference '.
356  'WHERE ref_id = '.$ilDB->quote($a_ref_id,'integer');
357 
358  $res = $ilDB->query($query);
359  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
360  {
361  $query = 'SELECT type, title FROM object_data '.
362  'WHERE obj_id = '.$ilDB->quote($row->obj_id,'integer');
363  $ores = $ilDB->query($query);
364 
365  $done = FALSE;
366  while($orow = $ores->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
367  {
368  $GLOBALS['ilLog']->write(__METHOD__.': Moving to recovery folder: '.$orow->type.': '.$orow->title);
369  $done = TRUE;
370 
371  include_once './Services/Object/classes/class.ilObjectFactory.php';
372  $factory = new ilObjectFactory();
373  $ref_obj = $factory->getInstanceByRefId($a_ref_id,FALSE);
374 
375  if($ref_obj instanceof ilObjRoleFolder)
376  {
377  $ref_obj->delete();
378  }
379  elseif($ref_obj instanceof ilObject)
380  {
381  $ref_obj->putInTree($a_parent_ref);
382  $ref_obj->setPermissions($a_parent_ref);
383  $GLOBALS['ilLog']->write(__METHOD__.': Moving finished');
384  break;
385  }
386  }
387  if(!$done)
388  {
389  // delete reference value
390  $query = 'DELETE FROM object_reference WHERE ref_id = '.$ilDB->quote($a_ref_id,'integer');
391  $ilDB->manipulate($query);
392  $GLOBALS['ilLog']->write(__METHOD__.': Delete reference for "object" without tree and object_data entry: ref_id= '.$a_ref_id );
393  }
394  }
395 
396  }
Class ilObjRoleFolder.
Class ilObjectFactory.
Class ilObject Basic functions for all objects.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilDB
+ Here is the caller graph for this function:

◆ repairMissingTreeEntries()

ilSCTreeTasks::repairMissingTreeEntries ( )

repair missing tree entries type $ilDB

Definition at line 425 of file class.ilSCTreeTasks.php.

References $GLOBALS, $ilDB, $query, $ref_id, $res, $row, deleteMissingTreeEntry(), ilDBConstants\FETCHMODE_OBJECT, and readMissingTreeEntries().

426  {
427  global $ilDB;
428 
429  $missing = $this->readMissingTreeEntries();
430  $GLOBALS['ilLog']->write(__METHOD__.': '.print_r($missing,TRUE));
431 
432  foreach($missing as $ref_id)
433  {
434  // check for duplicates
435  $query = 'SELECT tree, child FROM tree '.
436  'WHERE child = '.$ilDB->quote($ref_id);
437  $res = $ilDB->query($query);
438  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
439  {
440  $GLOBALS['ilLog']->write(__METHOD__.': '.$row->tree.': '.$ref_id);
441 
442  $this->deleteMissingTreeEntry($row->tree,$ref_id);
443  }
444  }
445  }
readMissingTreeEntries()
Read missing tree entries for referenced objects Entry in tree but no entry in object reference type...
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
deleteMissingTreeEntry($a_tree_id, $a_ref_id)
Delete missing tree entries from tree table.
$ref_id
Definition: sahs_server.php:39
global $ilDB
+ Here is the call graph for this function:

◆ repairPK()

static ilSCTreeTasks::repairPK ( )
static

Definition at line 46 of file class.ilSCTreeTasks.php.

References $GLOBALS, and array.

Referenced by ilSCTreeTasksGUI\deleteDuplicatesFromRepository(), and ilSCTreeTasksGUI\deleteDuplicatesFromTrash().

47  {
48  #$GLOBALS['ilDB']->dropPrimaryKey('tree');
49  $GLOBALS['ilDB']->addPrimaryKey('tree', array('child'));
50  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ validateDuplicates()

ilSCTreeTasks::validateDuplicates ( )

Definition at line 250 of file class.ilSCTreeTasks.php.

References checkDuplicates(), getTask(), IL_CAL_UNIX, ilSCTask\STATUS_COMPLETED, ilSCTask\STATUS_FAILED, and time.

251  {
252  $failures = $this->checkDuplicates();
253 
254  if(count($failures))
255  {
256  $this->getTask()->setStatus(ilSCTask::STATUS_FAILED);
257  }
258  else
259  {
260  $this->getTask()->setStatus(ilSCTask::STATUS_COMPLETED);
261  }
262  $this->getTask()->setLastUpdate(new ilDateTime(time(),IL_CAL_UNIX));
263  $this->getTask()->update();
264  return count($failures);
265  }
const STATUS_FAILED
const IL_CAL_UNIX
Date and time handling
const STATUS_COMPLETED
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
checkDuplicates()
Check for duplicates.
+ Here is the call graph for this function:

◆ validateStructure()

ilSCTreeTasks::validateStructure ( )

validate tree structure base on parent relation

Returns
type

Definition at line 207 of file class.ilSCTreeTasks.php.

References checkStructure(), getTask(), IL_CAL_UNIX, ilSCTask\STATUS_COMPLETED, ilSCTask\STATUS_FAILED, and time.

208  {
209  $failures = $this->checkStructure();
210 
211  if(count($failures))
212  {
213  $this->getTask()->setStatus(ilSCTask::STATUS_FAILED);
214  }
215  else
216  {
217  $this->getTask()->setStatus(ilSCTask::STATUS_COMPLETED);
218  }
219  $this->getTask()->setLastUpdate(new ilDateTime(time(),IL_CAL_UNIX));
220  $this->getTask()->update();
221  return count($failures);
222  }
const STATUS_FAILED
const IL_CAL_UNIX
Date and time handling
const STATUS_COMPLETED
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilSCTreeTasks::$db = null
private

Definition at line 11 of file class.ilSCTreeTasks.php.

Referenced by getDB().

◆ $task

ilSCTreeTasks::$task = null
private

Definition at line 12 of file class.ilSCTreeTasks.php.

Referenced by __construct(), and getTask().


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