30        $query = 
'SELECT child FROM tree first  ' .
 
   32                'SELECT child FROM tree second WHERE first.child = second.child ' .
 
   33                'GROUP BY child HAVING COUNT(child)  >  1 ) ' .
 
   34                'ORDER BY depth DESC';
 
   47        #$GLOBALS['ilDB']->dropPrimaryKey('tree'); 
   48        $GLOBALS[
'ilDB']->addPrimaryKey(
'tree', array(
'child'));
 
   55        $query = 
'SELECT * FROM tree WHERE child = ' . 
$ilDB->quote($a_child, 
'integer') . 
' AND tree = ' . 
$ilDB->quote($a_tree_id, 
'integer');
 
   60            $node[
'child'] = 
$row->child;
 
   61            $node[
'tree'] = 
$row->tree;
 
   62            $node[
'depth'] = 
$row->depth;
 
   65            $query = 
'SELECT obj_id FROM object_reference WHERE ref_id = ' . 
$ilDB->quote($a_child, 
'integer');
 
   68                $node[
'obj_id'] = $ref_row->obj_id;
 
   71                $query = 
'SELECT title, description, type FROM object_data ' .
 
   72                        'WHERE obj_id = ' . 
$ilDB->quote($ref_row->obj_id);
 
   75                    $node[
'title'] = $obj_row->title;
 
   76                    $node[
'description'] = $obj_row->description;
 
   77                    $node[
'type'] = $obj_row->type;
 
   84    public static function getChilds($a_tree_id, $a_childs)
 
   88        $query = 
'SELECT * FROM tree WHERE tree = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' . 
'AND child = ' . 
$ilDB->quote($a_childs, 
'integer');
 
   93            $childs[] = 
$row->child;
 
  107        $query = 
'SELECT * FROM tree first  ' .
 
  109                'SELECT child FROM tree second WHERE first.child = second.child ' .
 
  110                'GROUP BY child HAVING COUNT(child)  >  1 ) ' .
 
  111                'AND child = ' . 
$ilDB->quote($a_duplicate_id, 
'integer') . 
' ' .
 
  112                'ORDER BY depth DESC';
 
  120            $node[
'tree'] = 
$row->tree;
 
  121            $node[
'child'] = 
$row->child;
 
  122            $node[
'depth'] = 
$row->depth;
 
  134        return count(self::findDuplicates($a_child));
 
  140        foreach ($dups as $dup) {
 
  141            if ($a_delete_trash and $dup[
'tree'] < 1) {
 
  144            if (!$a_delete_trash and $dup[
'tree'] == 1) {
 
  155        $query = 
'SELECT child FROM tree ' .
 
  156                'WHERE parent = ' . 
$ilDB->quote($dup_id, 
'integer') . 
' ' .
 
  157                'AND tree = ' . 
$ilDB->quote($tree_id, 
'integer');
 
  164        if (self::hasDuplicate($dup_id)) {
 
  165            $query = 
'DELETE FROM tree ' .
 
  166                    'WHERE child = ' . 
$ilDB->quote($dup_id, 
'integer') . 
' ' .
 
  167                    'AND tree = ' . 
$ilDB->quote($tree_id, 
'integer');
 
  200        if (count($failures)) {
 
  207        return count($failures);
 
  213        return $GLOBALS[
'tree']->validateParentRelations();
 
  216        $query = 
'select child from tree child where not exists ' .
 
  218                'select child from tree parent where child.parent = parent.child and (parent.lft < child.lft) and (parent.rgt > child.rgt) ' .
 
  220                'and tree = 1 and child <> 1';
 
  225            $failures[] = 
$row->child;
 
  239        if (count($failures)) {
 
  246        return count($failures);
 
  254        $query = 
'SELECT child, count(child) num FROM tree ' .
 
  256                'HAVING count(child) > 1';
 
  263            $failures[] = 
$row->child;
 
  274        if (count($failures)) {
 
  282        return count($failures);
 
  295        if (count($failures)) {
 
  303        return count($failures);
 
  313        foreach ($failures as $ref_id) {
 
  327        $query = 
'SELECT obj_id FROM object_reference ' .
 
  328                'WHERE ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer');
 
  332            $query = 
'SELECT type, title FROM object_data ' .
 
  333                    'WHERE obj_id = ' . 
$ilDB->quote(
$row->obj_id, 
'integer');
 
  338                $GLOBALS[
'ilLog']->write(__METHOD__ . 
': Moving to recovery folder: ' . $orow->type . 
': ' . $orow->title);
 
  341                include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  343                $ref_obj = 
$factory->getInstanceByRefId($a_ref_id, 
false);
 
  347                } elseif ($ref_obj instanceof 
ilObject) {
 
  348                    $ref_obj->putInTree($a_parent_ref);
 
  349                    $ref_obj->setPermissions($a_parent_ref);
 
  350                    $GLOBALS[
'ilLog']->write(__METHOD__ . 
': Moving finished');
 
  356                $query = 
'DELETE FROM object_reference WHERE ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer');
 
  358                $GLOBALS[
'ilLog']->write(__METHOD__ . 
': Delete reference for "object" without tree and object_data entry: ref_id= ' . $a_ref_id);
 
  373        $query = 
'SELECT ref_id FROM object_reference ' .
 
  374                'LEFT JOIN tree ON ref_id = child ' .
 
  375                'WHERE child IS NULL';
 
  380            $failures[] = 
$row->ref_id;
 
  394        $GLOBALS[
'ilLog']->write(__METHOD__ . 
': ' . print_r($missing, 
true));
 
  396        foreach ($missing as $ref_id) {
 
  398            $query = 
'SELECT tree, child FROM tree ' .
 
  399                    'WHERE child = ' . 
$ilDB->quote($ref_id);
 
  402                $GLOBALS[
'ilLog']->write(__METHOD__ . 
': ' . 
$row->tree . 
': ' . $ref_id);
 
  416        $query = 
'SELECT child FROM tree ' .
 
  417                'WHERE parent = ' . 
$ilDB->quote($a_ref_id, 
'integer') . 
' ' .
 
  418                'AND tree = ' . 
$ilDB->quote($a_tree_id, 
'integer');
 
  423            $query = 
'SELECT tree, child FROM tree ' .
 
  424                    'WHERE child = ' . 
$ilDB->quote(
$row->child);
 
  432        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  434        $ref_obj = 
$factory->getInstanceByRefId($a_ref_id, 
false);
 
  436        if (($ref_obj instanceof 
ilObject) and $ref_obj->getType()) {
 
  440        $query = 
'DELETE from tree ' .
 
  441                'WHERE tree = ' . 
$ilDB->quote($a_tree_id) . 
' ' .
 
  442                'AND child = ' . 
$ilDB->quote($a_ref_id);
 
  457        $query = 
'SELECT child FROM tree ' .
 
  458                'LEFT JOIN object_reference ON child = ref_id ' .
 
  459                'WHERE ref_id IS NULL';
 
  465            $failures[] = 
$row->child;
 
  478        include_once 
'./Modules/Folder/classes/class.ilObjFolder.php';
 
  480        $folder->setTitle(
'__System check recovery: ' . $now->get(
IL_CAL_DATETIME));
 
  482        $folder->createReference();
 
  483        $folder->putInTree(RECOVERY_FOLDER_ID);
 
  485        return $folder->getRefId();
 
An exception for terminatinating execution or to throw for unit testing.
@classDescription Date and time handling
Class ilObject Basic functions for all objects.
Defines a system check task.
Defines a system check task.
static findDeepestDuplicate()
find duplicates @global type $ilDB
static findDuplicates($a_duplicate_id)
find duplicates @global type $ilDB
validateStructure()
validate tree structure base on parent relation
deleteMissingTreeEntry($a_tree_id, $a_ref_id)
Delete missing tree entries from tree table.
static deleteDuplicateFromTree($a_duplicate_id, $a_delete_trash)
findMissing()
Find missing objects.
__construct(ilSCTask $task)
repairMissingTreeEntries()
repair missing tree entries @global type $ilDB
checkDuplicates()
Check for duplicates.
static hasDuplicate($a_child)
static getNodeInfo($a_tree_id, $a_child)
readMissing()
Read missing objects in tree Entry in oject_reference but no entry in tree @global type $ilDB.
createRecoveryContainer()
Create a reccovery folder.
repairMissing()
Repair missing objects.
static getChilds($a_tree_id, $a_childs)
static deleteDuplicate($tree_id, $dup_id)
readMissingTreeEntries()
Read missing tree entries for referenced objects Entry in tree but no entry in object reference @glob...
repairMissingObject($a_parent_ref, $a_ref_id)
Repair missing object.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
foreach($_POST as $key=> $value) $res