32        $query = 
'SELECT child FROM tree first  ' .
 
   34                'SELECT child FROM tree second WHERE first.child = second.child ' .
 
   35                'GROUP BY child HAVING COUNT(child)  >  1 ) ' .
 
   36                'ORDER BY depth DESC';
 
   49        #$GLOBALS['DIC']['ilDB']->dropPrimaryKey('tree'); 
   50        $GLOBALS[
'DIC'][
'ilDB']->addPrimaryKey(
'tree', array(
'child'));
 
   59        $query = 
'SELECT * FROM tree WHERE child = ' . 
$ilDB->quote($a_child, 
'integer') . 
' AND tree = ' . 
$ilDB->quote($a_tree_id, 
'integer');
 
   64            $node[
'child'] = $row->child;
 
   65            $node[
'tree'] = $row->tree;
 
   66            $node[
'depth'] = $row->depth;
 
   69            $query = 
'SELECT obj_id FROM object_reference WHERE ref_id = ' . 
$ilDB->quote($a_child, 
'integer');
 
   72                $node[
'obj_id'] = $ref_row->obj_id;
 
   75                $query = 
'SELECT title, description, type FROM object_data ' .
 
   76                        'WHERE obj_id = ' . 
$ilDB->quote($ref_row->obj_id);
 
   79                    $node[
'title'] = $obj_row->title;
 
   80                    $node[
'description'] = $obj_row->description;
 
   81                    $node[
'type'] = $obj_row->type;
 
   88    public static function getChilds($a_tree_id, $a_childs)
 
   94        $query = 
'SELECT * FROM tree WHERE tree = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' . 
'AND child = ' . 
$ilDB->quote($a_childs, 
'integer');
 
   99            $childs[] = $row->child;
 
  115        $query = 
'SELECT * FROM tree first  ' .
 
  117                'SELECT child FROM tree second WHERE first.child = second.child ' .
 
  118                'GROUP BY child HAVING COUNT(child)  >  1 ) ' .
 
  119                'AND child = ' . 
$ilDB->quote($a_duplicate_id, 
'integer') . 
' ' .
 
  120                'ORDER BY depth DESC';
 
  128            $node[
'tree'] = $row->tree;
 
  129            $node[
'child'] = $row->child;
 
  130            $node[
'depth'] = $row->depth;
 
  144        return count(self::findDuplicates($a_child));
 
  150        foreach ($dups as $dup) {
 
  151            if ($a_delete_trash and $dup[
'tree'] < 1) {
 
  154            if (!$a_delete_trash and $dup[
'tree'] == 1) {
 
  167        $query = 
'SELECT child FROM tree ' .
 
  168                'WHERE parent = ' . 
$ilDB->quote($dup_id, 
'integer') . 
' ' .
 
  169                'AND tree = ' . 
$ilDB->quote($tree_id, 
'integer');
 
  176        if (self::hasDuplicate($dup_id)) {
 
  177            $query = 
'DELETE FROM tree ' .
 
  178                    'WHERE child = ' . 
$ilDB->quote($dup_id, 
'integer') . 
' ' .
 
  179                    'AND tree = ' . 
$ilDB->quote($tree_id, 
'integer');
 
  212        if (count($failures)) {
 
  219        return count($failures);
 
  225        return $GLOBALS[
'DIC'][
'tree']->validateParentRelations();
 
  230        $query = 
'select child from tree child where not exists ' .
 
  232                'select child from tree parent where child.parent = parent.child and (parent.lft < child.lft) and (parent.rgt > child.rgt) ' .
 
  234                'and tree = 1 and child <> 1';
 
  239            $failures[] = $row->child;
 
  253        if (count($failures)) {
 
  260        return count($failures);
 
  268        $query = 
'SELECT child, count(child) num FROM tree ' .
 
  270                'HAVING count(child) > 1';
 
  277            $failures[] = $row->child;
 
  290        if (count($failures)) {
 
  298        return count($failures);
 
  313        if (count($failures)) {
 
  321        return count($failures);
 
  331        foreach ($failures as $ref_id) {
 
  347        $query = 
'SELECT obj_id FROM object_reference ' .
 
  348                'WHERE ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer');
 
  352            $query = 
'SELECT type, title FROM object_data ' .
 
  353                    'WHERE obj_id = ' . 
$ilDB->quote($row->obj_id, 
'integer');
 
  358                $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': Moving to recovery folder: ' . $orow->type . 
': ' . $orow->title);
 
  361                include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  363                $ref_obj = 
$factory->getInstanceByRefId($a_ref_id, 
false);
 
  367                } elseif ($ref_obj instanceof 
ilObject) {
 
  368                    $ref_obj->putInTree($a_parent_ref);
 
  369                    $ref_obj->setPermissions($a_parent_ref);
 
  370                    $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': Moving finished');
 
  376                $query = 
'DELETE FROM object_reference WHERE ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer');
 
  378                $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': Delete reference for "object" without tree and object_data entry: ref_id= ' . $a_ref_id);
 
  395        $query = 
'SELECT ref_id FROM object_reference ' .
 
  396                'LEFT JOIN tree ON ref_id = child ' .
 
  397                'WHERE child IS NULL';
 
  402            $failures[] = $row->ref_id;
 
  418        $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': ' . print_r($missing, 
true));
 
  420        foreach ($missing as $ref_id) {
 
  422            $query = 
'SELECT tree, child FROM tree ' .
 
  423                    'WHERE child = ' . 
$ilDB->quote($ref_id);
 
  426                $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': ' . $row->tree . 
': ' . $ref_id);
 
  442        $query = 
'SELECT child FROM tree ' .
 
  443                'WHERE parent = ' . 
$ilDB->quote($a_ref_id, 
'integer') . 
' ' .
 
  444                'AND tree = ' . 
$ilDB->quote($a_tree_id, 
'integer');
 
  449            $query = 
'SELECT tree, child FROM tree ' .
 
  450                    'WHERE child = ' . 
$ilDB->quote($row->child);
 
  458        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  460        $ref_obj = 
$factory->getInstanceByRefId($a_ref_id, 
false);
 
  462        if (($ref_obj instanceof 
ilObject) and $ref_obj->getType()) {
 
  466        $query = 
'DELETE from tree ' .
 
  467                'WHERE tree = ' . 
$ilDB->quote($a_tree_id) . 
' ' .
 
  468                'AND child = ' . 
$ilDB->quote($a_ref_id);
 
  485        $query = 
'SELECT child FROM tree ' .
 
  486                'LEFT JOIN object_reference ON child = ref_id ' .
 
  487                'WHERE ref_id IS NULL';
 
  493            $failures[] = $row->child;
 
  506        include_once 
'./Modules/Folder/classes/class.ilObjFolder.php';
 
  508        $folder->setTitle(
'__System check recovery: ' . $now->get(
IL_CAL_DATETIME));
 
  510        $folder->createReference();
 
  511        $folder->putInTree(RECOVERY_FOLDER_ID);
 
  513        return $folder->getRefId();
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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.
foreach($_POST as $key=> $value) $res