Public Member Functions | Data Fields

ilValidator Class Reference

Inheritance diagram for ilValidator:
Collaboration diagram for ilValidator:

Public Member Functions

 ilValidator ($a_log=false)
 Constructor.
 setMode ($a_mode, $a_value)
 set mode of ilValidator Usage: setMode("restore",true) => enable object restorey setMode("all",true) => enable all features For all possible modes see variables declaration
 isModeEnabled ($a_mode)
 Is a particular mode enabled?
 isLogEnabled ()
 setModeDependencies ()
 Sets modes by considering mode dependencies; some modes require other modes to be activated.
 validate ()
 Performs the validation for each enabled mode.
 findMissingObjects ()
 Search database for all object entries with missing reference and/or tree entry and stores result in $this->missing_objects.
 findInvalidRolefolders ()
 Search database for all rolefolder object entries with missing reference entry.
 findInvalidRBACEntries ()
 Search database for all role entries that are linked to invalid ref_ids.
 getMissingObjects ()
 Gets all object entries with missing reference and/or tree entry.
 findInvalidReferences ()
 Search database for all reference entries that are not linked with a valid object id and stores result in $this->invalid_references.
 getInvalidReferences ()
 Gets all reference entries that are not linked with a valid object id.
 findInvalidChilds ()
 Search database for all tree entries without any link to a valid object and stores result in $this->invalid_childs.
 getInvalidChilds ()
 Gets all tree entries without any link to a valid object.
 findUnboundObjects ()
 Search database for all tree entries having no valid parent (=> no valid path to root node) and stores result in $this->unbound_objects Result does not contain childs that are marked as deleted! Deleted childs have a negative number.
 findDeletedObjects ()
 Search database for all tree entries having no valid parent (=> no valid path to root node) and stores result in $this->unbound_objects Result also contains childs that are marked as deleted! Deleted childs has a negative number in ["deleted"] otherwise NULL.
 getUnboundObjects ()
 Gets all tree entries having no valid parent (=> no valid path to root node) Returns an array with child => actual entry with broken uplink to its parent parent => parent of child that does not exist grandparent => grandparent of child (where path to root node continues) deleted => containing a negative number (= parent in trash) or NULL (parent does not exist at all).
 getDeletedObjects ()
 Gets all object in trash.
 getInvalidRolefolders ()
 Gets invalid rolefolders (same as missing objects).
 removeInvalidReferences ($a_invalid_refs=NULL)
 Removes all reference entries that are linked with invalid object IDs.
 removeInvalidChilds ($a_invalid_childs=NULL)
 Removes all tree entries without any link to a valid object.
 removeInvalidRolefolders ($a_invalid_rolefolders=NULL)
 Removes invalid rolefolders.
 restoreMissingObjects ($a_missing_objects=NULL)
 Restores missing reference and/or tree entry for all objects found by this::getMissingObjects() Restored object are placed in RecoveryFolder.
 restoreReference ($a_obj_id)
 restore a reference for an object Creates a new reference entry in DB table object_reference for $a_obj_id
 restoreUnboundObjects ($a_unbound_objects=NULL)
 Restore objects (and their subobjects) to RecoveryFolder that are valid but not linked correctly in the hierarchy because they point to an invalid parent_id.
 restoreTrash ($a_deleted_objects=NULL)
 Restore all objects in trash to RecoveryFolder NOTE: All objects will be restored to top of RecoveryFolder regardless of existing hierarchical structure!
 restoreDeletedObjects ($a_nodes)
 Restore deleted objects (and their subobjects) to RecoveryFolder.
 restoreSubTrees ($a_nodes)
 Restore objects (and their subobjects) to RecoveryFolder.
 purgeTrash ($a_nodes=NULL)
 Removes all objects in trash from system.
 purgeUnboundObjects ($a_nodes=NULL)
 Removes all invalid objects from system.
 purgeMissingObjects ($a_nodes=NULL)
 Removes all missing objects from system.
 purgeObjects ($a_nodes)
 removes objects from system
 initGapsInTree ()
 Initializes gaps in lft/rgt values of a tree.
 handleErr ($error)
 Callback function handles PEAR_error and outputs detailed infos about error TODO: implement that in global errorhandler of ILIAS (via templates).
 writeScanLogArray ($a_arr)
 writeScanLogLine ($a_msg)
 hasScanLog ()
 Quickly determine if there is a scan log.
 readScanLog ()
 get_last_scan ($a_scan_log)
 checkTreeStructure ($a_startnode=null)
 dumpTree ()
 Dumps the Tree structure into the scan log.

Data Fields

 $rbac_object_types = NULL
 $object_types_exclude
 $mode
 $invalid_references = array()
 $invalid_childs = array()
 $missing_objects = array()
 $unbound_objects = array()
 $deleted_objects = array()
 $invalid_rolefolders = array()
 $invalid_objects = array()
 $logging = false
 $scan_log
 $scan_log_file = "scanlog.log"
 $scan_log_separator = "<!-- scan log start -->"

Detailed Description

Definition at line 32 of file class.ilValidator.php.


Member Function Documentation

ilValidator::checkTreeStructure ( a_startnode = null  ) 

Definition at line 1949 of file class.ilValidator.php.

References $tree, and writeScanLogLine().

Referenced by validate().

        {
                global $tree;

                $this->writeScanLogLine("\nchecking tree structure is disabled");
                
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::dumpTree (  ) 

Dumps the Tree structure into the scan log.

public

Returns:
number of errors found while dumping tree

Definition at line 1963 of file class.ilValidator.php.

References $q, $row, and writeScanLogLine().

Referenced by validate().

        {
                $this->writeScanLogLine("BEGIN dumpTree:");

                // collect nodes with duplicate child Id's
                // (We use this, to mark these nodes later in the output as being
                // erroneous.).
                $q = 'SELECT child FROM tree GROUP BY child HAVING COUNT(*) > 1';
                $r = $this->db->query($q);
                $duplicateNodes = array();
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $duplicateNodes[] = $row->child;
                }               
                
                // dump tree
                $q = "SELECT tree.*,ref.ref_id,ref.obj_id AS refobj_id,dat.*,login "
                        ."FROM tree "
                        ."LEFT OUTER JOIN object_reference AS ref ON tree.child = ref.ref_id "
                        ."LEFT OUTER JOIN object_data AS dat ON ref.obj_id = dat.obj_id "
                        ."LEFT OUTER JOIN usr_data AS usr ON dat.owner = usr.usr_id "
                        ."ORDER BY tree, lft";
                $r = $this->db->query($q);
                
                $this->writeScanLogLine(
                        '<table><tr>'
                        .'<td>tree, child, parent, lft, rgt, depth</td>'
                        .'<td>ref_id, ref.obj_id</td>'
                        .'<td>obj_id, type, title</td>'
                        .'</tr>'
                );
                
                // We use a stack to represent the path to the current node.
                // This allows us to do analyze the tree structure without having
                // to implement a recursive algorithm.
                $stack = array();
                $error_count = 0;
                $repository_tree_count = 0;
                $trash_trees_count = 0;
                $other_trees_count = 0;
                $not_in_tree_count = 0;

                // The previous number is used for gap checking
                $previousNumber = 0; 

                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        // If there is no entry in table tree for the object, we display it here
                        if (is_null($row->child))
                        {
                                $not_in_tree_count++;
                                $error_count++;
                                $isRowOkay = false;
                                $isParentOkay = false;
                                $isLftOkay = false;
                                $isRgtOkay = false;
                                $isDepthOkay = false;
                                
                                $this->writeScanLogLine(
                                        '<tr>'
                                        .'<td>'
                                        .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                        .$row->tree.', '
                                        .$row->child.', '
                                        .(($isParentOkay) ? '' : 'parent:<b>')
                                        .$row->parent
                                        .(($isParentOkay) ? '' : '</b>')
                                        .', '
                                        .(($isLftOkay) ? '' : 'lft:<b>')
                                        .$row->lft
                                        .(($isLftOkay) ? '' : '</b>')
                                        .', '
                                        .(($isRgtOkay) ? '' : 'rgt:<b>')
                                        .$row->rgt
                                        .(($isRgtOkay) ? '' : '</b>')
                                        .', '
                                        .(($isDepthOkay) ? '' : 'depth:<b>')
                                        .$row->depth
                                        .(($isDepthOkay) ? '' : '</b>')
                                        .(($isRowOkay) ? '' : '</font>')
                                        .'</td><td>'
                                        .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                        .(($isRefRefOkay && $isChildOkay) ? '' : 'ref.ref_id:<b>')
                                        .$row->ref_id
                                        .(($isRefRefOkay && $isChildOkay) ? '' : '</b>')
                                        .', '
                                        .(($isRefObjOkay) ? '' : 'ref.obj_id:<b>')
                                        .$row->refobj_id
                                        .(($isRefObjOkay) ? '' : '</b>')
                                        .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                        .'</td><td>'
                                        .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                        .$indent
                                        .$row->obj_id.', '
                                        .$row->type.', '
                                        .$row->title.', '
                                        .$row->login
                                        .(($isRowOkay) ? '' : ' <b>*ERROR*</b><font color=#ff0000>')
                                        .'</td>'
                                        .'</tr>'
                                );
                                continue;
                        }
                
                        // Update stack
                        // -------------------
                        $indent = "";
                        for ($i = 1; $i < $row->depth; $i++)
                        {
                                $indent .= ". ";
                        }
                        
                        // Initialize the stack and the previous number if we are in a new tree
                        if (count($stack) == 0 || $stack[0]->tree != $row->tree) 
                        {
                                $stack = array();
                                $previousNumber = $row->lft - 1;
                        } 
                        // Pop old stack entries
                        while (count($stack) > 0 && $stack[count($stack) - 1]->rgt < $row->lft) 
                        {
                                $popped = array_pop($stack);
                                
                                // check for gap
                                $gap = $popped->rgt - $previousNumber - 1;
                                if ($gap > 0)
                                {
                                        $poppedIndent = "";
                                        for ($i = 1; $i < $popped->depth; $i++)
                                        {
                                                $poppedIndent .= ". ";
                                        }
                                        $this->writeScanLogLine(
                                                '<tr>'
                                                .'<td colspan=2><div align="right">'
                                                .'<font color=#00cc00>*gap* for '.($gap/2).' nodes at end of&nbsp;</font>'
                                                .'</div></td>'
                                                .'<td>'
                                                .'<font color=#00cc00>'
                                                .$poppedIndent
                                                .$popped->obj_id.', '
                                                .$popped->type.', '
                                                .$popped->title.', '
                                                .$popped->login
                                                .'</font>'
                                                .'</td>'
                                                .'</tr>'
                                        );
                                }
                                $previousNumber = $popped->rgt;
                                unset($popped);
                        }

                        // Check row integrity
                        // -------------------
                        $isRowOkay = true;
                        
                        // Check tree structure
                        $isChildOkay = true;
                        $isParentOkay = true;
                        $isLftOkay = true;
                        $isRgtOkay = true;
                        $isDepthOkay = true;
                        $isGap = false;
                        
                        if (count($stack) > 0) 
                        {                       
                                $parent = $stack[count($stack) - 1];
                                if ($parent->depth + 1 != $row->depth)
                                {
                                        $isDepthOkay = false;
                                        $isRowOkay = false;
                                }
                                if ($parent->child != $row->parent)
                                {
                                        $isParentOkay = false;
                                        $isRowOkay = false;
                                }
                                if ($parent->lft >= $row->lft)
                                {
                                        $isLftOkay = false;
                                        $isRowOkay = false;
                                }
                                if ($parent->rgt <= $row->rgt)
                                {
                                        $isRgtOkay = false;
                                        $isRowOkay = false;
                                }
                        }
                        
                        // Check lft rgt
                        if ($row->lft >= $row->rgt)
                        {
                                $isLftOkay = false;
                                $isRgtOkay = false;
                                $isRowOkay = false;
                        }
                        if (in_array($row->child, $duplicateNodes))
                        {
                                $isChildOkay = false;
                                $isRowOkay = false;
                        }
                        
                        // Check object reference
                        $isRefRefOkay = true;
                        $isRefObjOkay = true;
                        if ($row->ref_id == null)
                        {
                                $isRefRefOkay = false;
                                $isRowOkay = false;
                        }
                        if ($row->obj_id == null)
                        {
                                $isRefObjOkay = false;
                                $isRowOkay = false;
                        }
                        
                        if (! $isRowOkay)
                        {
                                $error_count++;
                        }

                        // Check for gap between siblings,
                        // and eventually write a log line
                        $gap = $row->lft - $previousNumber - 1;
                        $previousNumber = $row->lft;
                        if ($gap > 0)
                        {
                                $this->writeScanLogLine(
                                        '<tr>'
                                        .'<td colspan=2><div align="right">'
                                        .'<font color=#00cc00>*gap* for '.($gap/2).' nodes between&nbsp;</font>'
                                        .'</div></td>'
                                        .'<td>'
                                        .'<font color=#00cc00>siblings</font>'
                                        .'</td>'
                                        .'</tr>'
                                );
                        }
                                                
                        // Write log line
                        // -------------------
                        $this->writeScanLogLine(
                                '<tr>'
                                .'<td>'
                                .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                .$row->tree.', '
                                .$row->child.', '
                                .(($isParentOkay) ? '' : 'parent:<b>')
                                .$row->parent
                                .(($isParentOkay) ? '' : '</b>')
                                .', '
                                .(($isLftOkay) ? '' : 'lft:<b>')
                                .$row->lft
                                .(($isLftOkay) ? '' : '</b>')
                                .', '
                                .(($isRgtOkay) ? '' : 'rgt:<b>')
                                .$row->rgt
                                .(($isRgtOkay) ? '' : '</b>')
                                .', '
                                .(($isDepthOkay) ? '' : 'depth:<b>')
                                .$row->depth
                                .(($isDepthOkay) ? '' : '</b>')
                                .(($isRowOkay) ? '' : '</font>')
                                .'</td><td>'
                                .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                .(($isRefRefOkay && $isChildOkay) ? '' : 'ref.ref_id:<b>')
                                .$row->ref_id
                                .(($isRefRefOkay && $isChildOkay) ? '' : '</b>')
                                .', '
                                .(($isRefObjOkay) ? '' : 'ref.obj_id:<b>')
                                .$row->refobj_id
                                .(($isRefObjOkay) ? '' : '</b>')
                                .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                .'</td><td>'
                                .(($isRowOkay) ? '' : '<font color=#ff0000>')
                                .$indent
                                .$row->obj_id.', '
                                .$row->type.', '
                                .$row->title.', '
                                .$row->login
                                .(($isRowOkay) ? '' : ' <b>*ERROR*</b><font color=#ff0000>')
                                .'</td>'
                                .'</tr>'
                        );

                        // Update stack
                        // -------------------
                        // Push node on stack
                        $stack[] = $row;
                        
                        // Count nodes
                        // -----------------
                        if ($row->tree == 1)
                        {
                                $repository_tree_count++;
                        }
                        else if ($row->tree < 0)
                        {
                                $trash_trees_count++;
                        }
                        else
                        {
                                $other_trees_count++;
                        }               
                        
                }
                //
                // Pop remaining stack entries
                while (count($stack) > 0) 
                {
                        $popped = array_pop($stack);
                        
                        // check for gap
                        $gap = $popped->rgt - $previousNumber - 1;
                        if ($gap > 0)
                        {
                                $poppedIndent = "";
                                for ($i = 1; $i < $popped->depth; $i++)
                                {
                                        $poppedIndent .= ". ";
                                }
                                $this->writeScanLogLine(
                                        '<tr>'
                                        .'<td colspan=2><div align="right">'
                                        .'<font color=#00cc00>*gap* for '.($gap/2).' nodes at end of&nbsp;</font>'
                                        .'</div></td>'
                                        .'<td>'
                                        .'<font color=#00cc00>'
                                        .$poppedIndent
                                        .$popped->obj_id.', '
                                        .$popped->type.', '
                                        .$popped->title
                                        .'</font>'
                                        .'</td>'
                                        .'</tr>'
                                );
                        }
                        $previousNumber = $popped->rgt;
                        unset($popped);
                }
                
                //
                $this->writeScanLogLine("</table>");

                if ($error_count > 0)
                {
                        $this->writeScanLogLine('<font color=#ff0000>'.$error_count.' errors found while dumping tree.</font>');
                }
                else
                {
                        $this->writeScanLogLine('No errors found while dumping tree.');
                }
                $this->writeScanLogLine("$repository_tree_count nodes in repository tree");             
                $this->writeScanLogLine("$trash_trees_count nodes in trash trees");             
                $this->writeScanLogLine("$other_trees_count nodes in other trees");             
                $this->writeScanLogLine("$not_in_tree_count nodes are not in a tree");          
                $this->writeScanLogLine("END dumpTree");
                
                return $error_count;    
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::findDeletedObjects (  ) 

Search database for all tree entries having no valid parent (=> no valid path to root node) and stores result in $this->unbound_objects Result also contains childs that are marked as deleted! Deleted childs has a negative number in ["deleted"] otherwise NULL.

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getUnboundObjects()
this::restoreUnboundObjects()

Definition at line 968 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

Referenced by validate().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }

                // init
                $this->deleted_objects = array();

                $this->writeScanLogLine("\nfindDeletedObjects:");

                $q = "SELECT object_data.*,tree.tree,tree.child,tree.parent FROM object_data ".
                         "LEFT JOIN object_reference ON object_data.obj_id=object_reference.obj_id ".
                         "LEFT JOIN tree ON tree.child=object_reference.ref_id ".
                         " WHERE tree !=1";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->deleted_objects[] = array(
                                                                                        "child"                 => $row->child,
                                                                                        "parent"                => $row->parent,
                                                                                        "tree"                  => $row->tree,
                                                                                        "type"                  => $row->type,
                                                                                        "title"                 => $row->title,
                                                                                        "desc"                  => $row->description,
                                                                                        "owner"                 => $row->owner,
                                                                                        "create_date"   => $row->create_date,
                                                                                        "last_update"   => $row->last_update
                                                                                        );
                }

                if (count($this->deleted_objects) > 0)
                {
                        $this->writeScanLogLine("obj_id\tref_id\ttree\ttype\ttitle\tdesc\towner\tcreate_date\tlast_update");
                        $this->writeScanLogArray($this->deleted_objects);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::findInvalidChilds (  ) 

Search database for all tree entries without any link to a valid object and stores result in $this->invalid_childs.

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getInvalidChilds()
this::removeInvalidChilds()

Definition at line 851 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

Referenced by purgeObjects(), restoreSubTrees(), and validate().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }

                // init
                $this->invalid_childs = array();

                $this->writeScanLogLine("\nfindInvalidChilds:");

                $q = "SELECT tree.*,object_reference.ref_id FROM tree ".
                         "LEFT JOIN object_reference ON tree.child = object_reference.ref_id ".
                         "LEFT JOIN object_data ON object_reference.obj_id = object_data.obj_id ".
                         "WHERE object_reference.ref_id IS NULL or object_data.obj_id IS NULL";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->invalid_childs[] = array(
                                                                                        "child"         => $row->child,
                                                                                        "ref_id"        => $row->ref_id,
                                                                                        "msg"           => "No object found"
                                                                                        );
                }

                if (count($this->invalid_childs) > 0)
                {
                        $this->writeScanLogLine("child\t\tref_id");
                        $this->writeScanLogArray($this->invalid_childs);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::findInvalidRBACEntries (  ) 

Search database for all role entries that are linked to invalid ref_ids.

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getInvalidRBACEntries()
this::removeInvalidRBACEntries()

Definition at line 694 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }
                
                // init
                $this->invalid_rbac_entries = array();
                
                $this->writeScanLogLine("\nfindInvalidRBACEntries:");

                $q = "SELECT object_data.*, ref_id FROM object_data ".
                         "LEFT JOIN object_reference ON object_data.obj_id = object_reference.obj_id ".
                         "LEFT JOIN tree ON object_reference.ref_id = tree.child ".
                         "WHERE (object_reference.obj_id IS NULL OR tree.child IS NULL) ".
                         "AND object_data.type='rolf'";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->invalid_rolefolders[] = array(
                                                                                                "obj_id"                => $row->obj_id,
                                                                                                "type"                  => $row->type,
                                                                                                "ref_id"                => $row->ref_id,
                                                                                                "child"                 => $row->child,
                                                                                                "title"                 => $row->title,
                                                                                                "desc"                  => $row->description,
                                                                                                "owner"                 => $row->owner,
                                                                                                "create_date"   => $row->create_date,
                                                                                                "last_update"   => $row->last_update
                                                                                        );
                }
                
                // find rolfs within RECOVERY FOLDER
                $q = "SELECT object_data.*, ref_id FROM object_data ".
                         "LEFT JOIN object_reference ON object_data.obj_id = object_reference.obj_id ".
                         "LEFT JOIN tree ON object_reference.ref_id = tree.child ".
                         "WHERE object_reference.ref_id ='".RECOVERY_FOLDER_ID."' ".
                         "AND object_data.type='rolf'";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->invalid_rolefolders[] = array(
                                                                                                "obj_id"                => $row->obj_id,
                                                                                                "type"                  => $row->type,
                                                                                                "ref_id"                => $row->ref_id,
                                                                                                "child"                 => $row->child,
                                                                                                "title"                 => $row->title,
                                                                                                "desc"                  => $row->description,
                                                                                                "owner"                 => $row->owner,
                                                                                                "create_date"   => $row->create_date,
                                                                                                "last_update"   => $row->last_update
                                                                                        );
                }
                        
                if (count($this->invalid_rolefolders) > 0)
                {
                        $this->writeScanLogLine("obj_id\ttype\tref_id\tchild\ttitle\tdesc\towner\tcreate_date\tlast_update");
                        $this->writeScanLogArray($this->invalid_rolefolders);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;   
        }

Here is the call graph for this function:

ilValidator::findInvalidReferences (  ) 

Search database for all reference entries that are not linked with a valid object id and stores result in $this->invalid_references.

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getInvalidReferences()
this::removeInvalidReferences()

Definition at line 790 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

Referenced by validate().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }

                // init
                $this->invalid_references = array();
                
                $this->writeScanLogLine("\nfindInvalidReferences:");

                $q = "SELECT object_reference.* FROM object_reference ".
                         "LEFT JOIN object_data ON object_data.obj_id = object_reference.obj_id ".
                         "WHERE object_data.obj_id IS NULL ".
                         "OR object_data.type NOT IN (".$this->rbac_object_types.")";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->invalid_references[] = array(
                                                                                        "ref_id"        => $row->ref_id,
                                                                                        "obj_id"        => $row->obj_id,
                                                                                        "msg"           => "Object does not exist."
                                                                                        );
                }

                if (count($this->invalid_references) > 0)
                {
                        $this->writeScanLogLine("ref_id\t\tobj_id");
                        $this->writeScanLogArray($this->invalid_references);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;   
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::findInvalidRolefolders (  ) 

Search database for all rolefolder object entries with missing reference entry.

Furthermore gets all rolefolders that are placed accidently in RECOVERY_FOLDER from earlier versions of System check. Result is stored in $this->invalid_rolefolders

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getInvalidRolefolders()
this::removeInvalidRolefolders()

Definition at line 615 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

Referenced by validate().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }
                
                // init
                $this->invalid_rolefolders = array();
                
                $this->writeScanLogLine("\nfindInvalidRolefolders:");

                // find rolfs without reference/tree entry
                $q = "SELECT object_data.*, ref_id FROM object_data ".
                         "LEFT JOIN object_reference ON object_data.obj_id = object_reference.obj_id ".
                         "LEFT JOIN tree ON object_reference.ref_id = tree.child ".
                         "WHERE (object_reference.obj_id IS NULL OR tree.child IS NULL) ".
                         "AND object_data.type='rolf'";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->invalid_rolefolders[] = array(
                                                                                                "obj_id"                => $row->obj_id,
                                                                                                "type"                  => $row->type,
                                                                                                "ref_id"                => $row->ref_id,
                                                                                                "child"                 => $row->child,
                                                                                                "title"                 => $row->title,
                                                                                                "desc"                  => $row->description,
                                                                                                "owner"                 => $row->owner,
                                                                                                "create_date"   => $row->create_date,
                                                                                                "last_update"   => $row->last_update
                                                                                        );
                }
                
                // find rolfs within RECOVERY FOLDER
                $q = "SELECT object_data.*, ref_id FROM object_data ".
                         "LEFT JOIN object_reference ON object_data.obj_id = object_reference.obj_id ".
                         "LEFT JOIN tree ON object_reference.ref_id = tree.child ".
                         "WHERE object_reference.ref_id ='".RECOVERY_FOLDER_ID."' ".
                         "AND object_data.type='rolf'";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->invalid_rolefolders[] = array(
                                                                                                "obj_id"                => $row->obj_id,
                                                                                                "type"                  => $row->type,
                                                                                                "ref_id"                => $row->ref_id,
                                                                                                "child"                 => $row->child,
                                                                                                "title"                 => $row->title,
                                                                                                "desc"                  => $row->description,
                                                                                                "owner"                 => $row->owner,
                                                                                                "create_date"   => $row->create_date,
                                                                                                "last_update"   => $row->last_update
                                                                                        );
                }
                        
                if (count($this->invalid_rolefolders) > 0)
                {
                        $this->writeScanLogLine("obj_id\ttype\tref_id\tchild\ttitle\tdesc\towner\tcreate_date\tlast_update");
                        $this->writeScanLogArray($this->invalid_rolefolders);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;   
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::findMissingObjects (  ) 

Search database for all object entries with missing reference and/or tree entry and stores result in $this->missing_objects.

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getMissingObjects()
this::restoreMissingObjects()

Definition at line 555 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

Referenced by validate().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }
                
                // init
                $this->missing_objects = array();
        
                $this->writeScanLogLine("\nfindMissingObjects:");
                
                $q = "SELECT object_data.*, ref_id FROM object_data ".
                         "LEFT JOIN object_reference ON object_data.obj_id = object_reference.obj_id ".
                         "LEFT JOIN tree ON object_reference.ref_id = tree.child ".
                         "WHERE (object_reference.obj_id IS NULL OR tree.child IS NULL) ".
                         "AND object_data.type IN (".$this->rbac_object_types.")";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if (!in_array($row->type,$this->object_types_exclude))
                        {
                                $this->missing_objects[] = array(
                                                                                                        "obj_id"                => $row->obj_id,
                                                                                                        "type"                  => $row->type,
                                                                                                        "ref_id"                => $row->ref_id,
                                                                                                        "child"                 => $row->child,
                                                                                                        "title"                 => $row->title,
                                                                                                        "desc"                  => $row->description,
                                                                                                        "owner"                 => $row->owner,
                                                                                                        "create_date"   => $row->create_date,
                                                                                                        "last_update"   => $row->last_update
                                                                                                );
                        }
                }
                
                if (count($this->missing_objects) > 0)
                {
                        $this->writeScanLogLine("obj_id\ttype\tref_id\tchild\ttitle\tdesc\towner\tcreate_date\tlast_update");
                        $this->writeScanLogArray($this->missing_objects);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;   
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::findUnboundObjects (  ) 

Search database for all tree entries having no valid parent (=> no valid path to root node) and stores result in $this->unbound_objects Result does not contain childs that are marked as deleted! Deleted childs have a negative number.

public

Returns:
boolean false if analyze mode disabled or nothing found
See also:
this::getUnboundObjects()
this::restoreUnboundObjects()

Definition at line 914 of file class.ilValidator.php.

References $q, $row, writeScanLogArray(), and writeScanLogLine().

Referenced by validate().

        {
                // check mode: analyze
                if ($this->mode["scan"] !== true)
                {
                        return false;
                }

                // init
                $this->unbound_objects = array();

                $this->writeScanLogLine("\nfindUnboundObjects:");

                $q = "SELECT T2.tree AS deleted,T1.child,T1.parent,T2.parent AS grandparent FROM tree AS T1 ".
                         "LEFT JOIN tree AS T2 ON T2.child=T1.parent ".
                         "WHERE (T2.tree!=1 OR T2.tree IS NULL) AND T1.parent!=0";
                $r = $this->db->query($q);
                
                while ($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        // exclude deleted nodes
                        if ($row->deleted === NULL)
                        {
                                $this->unbound_objects[] = array(
                                                                                                "child"                 => $row->child,
                                                                                                "parent"                => $row->parent,
                                                                                                "tree"                  => 1,
                                                                                                "msg"                   => "No valid parent node found"
                                                                                                );
                        }
                }

                if (count($this->unbound_objects) > 0)
                {
                        $this->writeScanLogLine("child\t\tparent\ttree");
                        $this->writeScanLogArray($this->unbound_objects);
                        return true;
                }

                $this->writeScanLogLine("none");
                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::get_last_scan ( a_scan_log  ) 

Definition at line 1937 of file class.ilValidator.php.

Referenced by readScanLog().

        {
                $logs = array_keys($a_scan_log,$this->scan_log_separator."\n");
                
                if (count($logs) > 0)
                {
                        return array_slice($a_scan_log,array_pop($logs)+2);
                }
                
                return false;
        }

Here is the caller graph for this function:

ilValidator::getDeletedObjects (  ) 

Gets all object in trash.

public

Returns:
array objects in trash

Definition at line 1038 of file class.ilValidator.php.

Referenced by validate().

        {
                return $this->deleted_objects;
        }

Here is the caller graph for this function:

ilValidator::getInvalidChilds (  ) 

Gets all tree entries without any link to a valid object.

public

Returns:
array
See also:
this::findInvalidChilds()
this::removeInvalidChilds()

Definition at line 898 of file class.ilValidator.php.

Referenced by validate().

        {
                return $this->invalid_childs;
        }

Here is the caller graph for this function:

ilValidator::getInvalidReferences (  ) 

Gets all reference entries that are not linked with a valid object id.

public

Returns:
array
See also:
this::findInvalidReferences()
this::removeInvalidReferences()

Definition at line 837 of file class.ilValidator.php.

Referenced by validate().

        {
                return $this->invalid_references;
        }

Here is the caller graph for this function:

ilValidator::getInvalidRolefolders (  ) 

Gets invalid rolefolders (same as missing objects).

public

Returns:
array
See also:
this::findMissingObjects()
this::removeInvalidRolefolders()

Definition at line 1051 of file class.ilValidator.php.

Referenced by validate().

        {
                return $this->invalid_rolefolders;
        }

Here is the caller graph for this function:

ilValidator::getMissingObjects (  ) 

Gets all object entries with missing reference and/or tree entry.

Returns array with obj_id => actual object entry with missing reference or tree type => symbolic name of object type ref_id => reference entry of object (or NULL if missing) child => always NULL (only for debugging and verification)

public

Returns:
array
See also:
this::findMissingObjects()
this::restoreMissingObjects()

Definition at line 776 of file class.ilValidator.php.

Referenced by validate().

        {
                return $this->missing_objects;
        }

Here is the caller graph for this function:

ilValidator::getUnboundObjects (  ) 

Gets all tree entries having no valid parent (=> no valid path to root node) Returns an array with child => actual entry with broken uplink to its parent parent => parent of child that does not exist grandparent => grandparent of child (where path to root node continues) deleted => containing a negative number (= parent in trash) or NULL (parent does not exist at all).

public

Returns:
array
See also:
this::findUnboundObjects()
this::restoreUnboundObjects()

Definition at line 1027 of file class.ilValidator.php.

Referenced by validate().

        {
                return $this->unbound_objects;
        }

Here is the caller graph for this function:

ilValidator::handleErr ( error  ) 

Callback function handles PEAR_error and outputs detailed infos about error TODO: implement that in global errorhandler of ILIAS (via templates).

private

Parameters:
object PEAR_error
See also:
PEAR::PEAR_error()

Definition at line 1821 of file class.ilValidator.php.

References $type, and exit.

        {
                $call_loc = $error->backtrace[count($error->backtrace)-1];
                $num_args = count($call_loc["args"]);

                if ($num_args > 0)
                {
                        foreach ($call_loc["args"] as $arg)
                        {
                                $type = gettype($arg);
                                
                                switch ($type)
                                {
                                        case "string":
                                                $value = strlen($arg);
                                                break;

                                        case "array":
                                                $value = count($arg);
                                                break;

                                        case "object":
                                                $value = get_class($arg);
                                                break;

                                        case "boolean":
                                                $value = ($arg) ? "true" : "false";
                                                break;
                                                
                                        default:
                                                $value = $arg;
                                                break;
                                }
                                
                                $arg_list[] = array(
                                                                        "type"  => $type,
                                                                        "value" => "(".$value.")"
                                                                        );
                        }
                        
                        foreach ($arg_list as $arg)
                        {
                                $arg_str .= implode("",$arg)." ";
                        }
                }

                $err_msg = "<br/><b>".$error->getCode().":</b> ".$error->getMessage()." in ".$call_loc["class"].$call_loc["type"].$call_loc["function"]."()".
                                   "<br/>Called from: ".basename($call_loc["file"])." , line ".$call_loc["line"].
                                   "<br/>Passed parameters: [".$num_args."] ".$arg_str."<br/>";
                printf($err_msg);
                
                if ($error->getUserInfo())
                {
                        printf("<br/>Parameter details:");
                        echo "<pre>";
                        var_dump($call_loc["args"]);
                        echo "</pre>";
                }
                
                if ($error->getCode() == FATAL)
                {
                        exit();
                }
        }

ilValidator::hasScanLog (  ) 

Quickly determine if there is a scan log.

Definition at line 1912 of file class.ilValidator.php.

Referenced by readScanLog().

        {
                // file check
                return is_file(CLIENT_DATA_DIR."/".$this->scan_log_file);
        }

Here is the caller graph for this function:

ilValidator::ilValidator ( a_log = false  ) 

Constructor.

public

Parameters:
integer mode

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

References writeScanLogLine().

        {
                global $objDefinition, $ilDB;
                
                $this->PEAR();
                $this->db =& $ilDB;
                $this->rbac_object_types = "'".implode("','",$objDefinition->getAllRBACObjects())."'";
        $this->setErrorHandling(PEAR_ERROR_CALLBACK,array(&$this, 'handleErr'));
                
                if ($a_log === true)
                {
                        $this->logging = true;

                        // should be available thru inc.header.php
                        // TODO: move log functionality to new class ilScanLog
                        include_once "classes/class.ilLog.php";
                
                        // create scan log
                        $this->scan_log = new ilLog(CLIENT_DATA_DIR,"scanlog.log");
                        $this->scan_log->setLogFormat("");
                        $this->writeScanLogLine($this->scan_log_separator);
                        $this->writeScanLogLine("\n[Systemscan from ".date("y-m-d H:i]"));
                }
        }

Here is the call graph for this function:

ilValidator::initGapsInTree (  ) 

Initializes gaps in lft/rgt values of a tree.

Depending on the value of the gap property of the tree, this function either closes all gaps in the tree, or equally distributes gaps all over the tree.

Wrapper for ilTree::renumber()

public

Returns:
boolean false if clean mode disabled
See also:
ilTree::renumber()

Definition at line 1790 of file class.ilValidator.php.

References $ilLog, $tree, and writeScanLogLine().

Referenced by validate().

        {
                global $tree,$ilLog;
                
                $message = sprintf('%s::initGapsInTree(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);

                // check mode: clean
                if ($this->mode["clean"] !== true)
                {
                        return false;
                }
                $this->writeScanLogLine("\nrenumberTree:");

                $tree->renumber(ROOT_FOLDER_ID);

                $this->writeScanLogLine("done");

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::isLogEnabled (  ) 

Definition at line 212 of file class.ilValidator.php.

Referenced by writeScanLogArray(), and writeScanLogLine().

        {
                return $this->logging;
        }

Here is the caller graph for this function:

ilValidator::isModeEnabled ( a_mode  ) 

Is a particular mode enabled?

public

Parameters:
string mode to query
Returns:
boolean
See also:
this::setMode()

Definition at line 201 of file class.ilValidator.php.

Referenced by validate().

        {
                if (!in_array($a_mode,array_keys($this->mode)))
                {
                        $this->throwError(VALIDATER_UNKNOWN_MODE, WARNING, DEBUG);
                        return false;
                }
                
                return $this->mode[$a_mode];
        }

Here is the caller graph for this function:

ilValidator::purgeMissingObjects ( a_nodes = NULL  ) 

Removes all missing objects from system.

public

Parameters:
array list of nodes to delete
Returns:
boolean true on success
See also:
this::purgeObjects()
this::findMissingObjects()

Definition at line 1704 of file class.ilValidator.php.

References $ilLog, purgeObjects(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilLog;
                
                // check mode: purge
                if ($this->mode["purge"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\npurgeMissingObjects:");

                if ($a_nodes === NULL and isset($this->missing_objects))
                {
                        $a_nodes = $this->missing_objects;
                }

                $message = sprintf('%s::purgeMissingObjects(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                // start purge process
                return $this->purgeObjects($a_nodes);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::purgeObjects ( a_nodes  ) 

removes objects from system

private

Parameters:
array list of objects
Returns:
boolean

Definition at line 1736 of file class.ilValidator.php.

References $ilias, $ilLog, $ref_id, ilTree::_removeEntry(), findInvalidChilds(), removeInvalidChilds(), and writeScanLogLine().

Referenced by purgeMissingObjects(), purgeTrash(), and purgeUnboundObjects().

        {
                global $ilias,$ilLog;

                // handle wrong input
                if (!is_array($a_nodes)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }
                
                // start delete process
                foreach ($a_nodes as $node)
                {
                        $ref_id = ($node["child"]) ? $node["child"] : $node["ref_id"];
                        $node_obj =& $ilias->obj_factory->getInstanceByRefId($ref_id,false);
                        
                        if ($node_obj === false)
                        {
                                $this->invalid_objects[] = $node;
                                continue;
                        }

                        $message = sprintf('%s::purgeObjects(): Removing object (id:%s ref:%s)',
                                                           get_class($this),
                                                           $ref_id,
                                                           $node_obj->getId);
                        $ilLog->write($message,$ilLog->WARNING);
                
                        $node_obj->delete();
                        ilTree::_removeEntry($node["tree"],$ref_id);
                        
                        $this->writeScanLogLine("Object '".$node_obj->getId()."' deleted");
                }
                
                $this->findInvalidChilds();
                $this->removeInvalidChilds();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::purgeTrash ( a_nodes = NULL  ) 

Removes all objects in trash from system.

public

Parameters:
array list of nodes to delete
Returns:
boolean true on success
See also:
this::purgeObjects()
this::findDeletedObjects()

Definition at line 1636 of file class.ilValidator.php.

References $ilLog, purgeObjects(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilLog;
                
                // check mode: purge_trash
                if ($this->mode["purge_trash"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\npurgeTrash:");
        
                if ($a_nodes === NULL and isset($this->deleted_objects))
                {
                        $a_nodes = $this->deleted_objects;
                }

                $message = sprintf('%s::purgeTrash(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                // start purge process
                return $this->purgeObjects($a_nodes);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::purgeUnboundObjects ( a_nodes = NULL  ) 

Removes all invalid objects from system.

public

Parameters:
array list of nodes to delete
Returns:
boolean true on success
See also:
this::purgeObjects()
this::findUnboundObjects()

Definition at line 1670 of file class.ilValidator.php.

References $ilLog, purgeObjects(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilLog;
                
                // check mode: purge
                if ($this->mode["purge"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\npurgeUnboundObjects:");

                if ($a_nodes === NULL and isset($this->unbound_objects))
                {
                        $a_nodes = $this->unbound_objects;
                }

                $message = sprintf('%s::purgeUnboundObjects(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                // start purge process
                return $this->purgeObjects($a_nodes);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::readScanLog (  ) 

Definition at line 1918 of file class.ilValidator.php.

References $scan_log, get_last_scan(), and hasScanLog().

        {
                // file check
                if (! $this->hasScanLog())
                {
                        return false;
                }

                $scanfile =& file(CLIENT_DATA_DIR."/".$this->scan_log_file);
                if (!$scan_log =& $this->get_last_scan($scanfile))
                {
                        return false;
                }
                // Ensure that memory is freed
                unset($scanfile);
                
                return $scan_log;
        }

Here is the call graph for this function:

ilValidator::removeInvalidChilds ( a_invalid_childs = NULL  ) 

Removes all tree entries without any link to a valid object.

public

Parameters:
array invalid IDs in tree (optional)
Returns:
boolean true if any ID were removed / false on error or clean mode disabled
See also:
this::getInvalidChilds()
this::findInvalidChilds()

Definition at line 1128 of file class.ilValidator.php.

References $ilLog, $q, and writeScanLogLine().

Referenced by purgeObjects(), restoreSubTrees(), and validate().

        {
                global $ilLog;

                // check mode: clean
                if ($this->mode["clean"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\nremoveInvalidChilds:");

                if ($a_invalid_childs === NULL and isset($this->invalid_childs))
                {
                        $a_invalid_childs =& $this->invalid_childs; 
                }

                // handle wrong input
                if (!is_array($a_invalid_childs))
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                // no unbound childs found. do nothing
                if (count($a_invalid_childs) == 0)
                {
                        $this->writeScanLogLine("none");
                        return false;
                }

/*******************
removal starts here
********************/

                $message = sprintf('%s::removeInvalidChilds(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);

                foreach ($a_invalid_childs as $entry)
                {
                        $q = "DELETE FROM tree WHERE child='".$entry["child"]."'";
                        $this->db->query($q);

                        $message = sprintf('%s::removeInvalidChilds(): Entry child=%s removed',
                                                           get_class($this),
                                                           $entry["child"]);
                        $ilLog->write($message,$ilLog->WARNING);
                                
                        $this->writeScanLogLine("Entry ".$entry["child"]." removed");
                }
                
                return true;    
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::removeInvalidReferences ( a_invalid_refs = NULL  ) 

Removes all reference entries that are linked with invalid object IDs.

public

Parameters:
array invalid IDs in object_reference (optional)
Returns:
boolean true if any ID were removed / false on error or clean mode disabled
See also:
this::getInvalidReferences()
this::findInvalidReferences()

Definition at line 1065 of file class.ilValidator.php.

References $ilLog, $q, and writeScanLogLine().

Referenced by validate().

        {
                global $ilLog;

                // check mode: clean
                if ($this->mode["clean"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\nremoveInvalidReferences:");

                if ($a_invalid_refs === NULL and isset($this->invalid_references))
                {
                        $a_invalid_refs =& $this->invalid_references; 
                }

                // handle wrong input
                if (!is_array($a_invalid_refs))
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }
                // no unbound references found. do nothing
                if (count($a_invalid_refs) == 0)
                {
                        $this->writeScanLogLine("none");
                        return false;
                }

/*******************
removal starts here
********************/

                $message = sprintf('%s::removeInvalidReferences(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);

                foreach ($a_invalid_refs as $entry)
                {
                        $q = "DELETE FROM object_reference WHERE ref_id='".$entry["ref_id"]."' AND obj_id='".$entry["obj_id"]."'";
                        $this->db->query($q);

                        $message = sprintf('%s::removeInvalidReferences(): Reference %s removed',
                                                           get_class($this),
                                                           $entry["ref_id"]);
                        $ilLog->write($message,$ilLog->WARNING);
                        
                        $this->writeScanLogLine("Entry ".$entry["ref_id"]." removed");
                }
                
                return true;    
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::removeInvalidRolefolders ( a_invalid_rolefolders = NULL  ) 

Removes invalid rolefolders.

public

Parameters:
array obj_ids of rolefolder objects (optional)
Returns:
boolean true if any object were removed / false on error or remove mode disabled
See also:
this::getInvalidRolefolders()
this::findMissingObjects()

Definition at line 1193 of file class.ilValidator.php.

References $ilias, $ilLog, restoreReference(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilias,$ilLog;
                
                // check mode: clean
                if ($this->mode["clean"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\nremoveInvalidRolefolders:");

                if ($a_invalid_rolefolders === NULL and isset($this->invalid_rolefolders))
                {
                        $a_invalid_rolefolders = $this->invalid_rolefolders;
                }

                // handle wrong input
                if (!is_array($a_invalid_rolefolders)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                // no invalid rolefolders found. do nothing
                if (count($a_invalid_rolefolders) == 0)
                {
                        $this->writeScanLogLine("none");
                        return false;
                }
                
/*******************
removal starts here
********************/

                $removed = false;
                
                $message = sprintf('%s::removeInvalidRolefolders(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                foreach ($a_invalid_rolefolders as $rolf)
                {
                        // restore ref_id in case of missing
                        if ($rolf["ref_id"] === NULL)
                        {
                                $rolf["ref_id"] = $this->restoreReference($rolf["obj_id"]);

                                $this->writeScanLogLine("Created missing reference '".$rolf["ref_id"]."' for rolefolder object '".$rolf["obj_id"]."'");
                        }

                        // now delete rolefolder
                        $obj_data =& $ilias->obj_factory->getInstanceByRefId($rolf["ref_id"]);
                        $obj_data->delete();
                        unset($obj_data);
                        $removed = true;
                        $this->writeScanLogLine("Removed invalid rolefolder '".$rolf["title"]."' (id=".$rolf["obj_id"].",ref=".$rolf["ref_id"].") from system");
                }
                
                return $removed;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::restoreDeletedObjects ( a_nodes  ) 

Restore deleted objects (and their subobjects) to RecoveryFolder.

private

Parameters:
array list of nodes
Returns:
boolean false on error or restore mode disabled
See also:
this::restoreTrash()

Definition at line 1472 of file class.ilValidator.php.

References $ilias, $ilLog, $key, $rbacadmin, $tree, and writeScanLogLine().

Referenced by restoreTrash().

        {
                global $tree,$rbacadmin,$ilias,$ilLog;
//vd($a_nodes);exit;
                // handle wrong input
                if (!is_array($a_nodes)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                // no invalid parents found. do nothing
                if (count($a_nodes) == 0)
                {
                        $this->writeScanLogLine("none");
                        return false;
                }

                $message = sprintf('%s::restoreDeletedObjects()): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);

                // first delete all rolefolders
                // don't save rolefolders, remove them
                // TODO process ROLE_FOLDER_ID
                foreach ($a_nodes as $key => $node)
                {
                        if ($node["type"] == "rolf")
                        {
                                // delete old tree entries
                                $tree->deleteTree($node);

                                $obj_data =& $ilias->obj_factory->getInstanceByRefId($node["child"]);
                                $obj_data->delete();
                                unset($a_nodes[$key]);
                        }       
                }
                
                // process move
                foreach ($a_nodes as $node)
                {
                        // delete old tree entries
                        $tree->deleteTree($node);
                        
                        $rbacadmin->revokePermission($node["child"]);
                        $obj_data =& $ilias->obj_factory->getInstanceByRefId($node["child"]);
                        $obj_data->putInTree(RECOVERY_FOLDER_ID);
                        $obj_data->setPermissions(RECOVERY_FOLDER_ID);
                        $obj_data->initDefaultRoles();
                }
                
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::restoreMissingObjects ( a_missing_objects = NULL  ) 

Restores missing reference and/or tree entry for all objects found by this::getMissingObjects() Restored object are placed in RecoveryFolder.

public

Parameters:
array obj_ids of missing objects (optional)
Returns:
boolean true if any object were restored / false on error or restore mode disabled
See also:
this::getMissingObjects()
this::findMissingObjects()

Definition at line 1265 of file class.ilValidator.php.

References $ilias, $ilLog, $rbacadmin, restoreReference(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilias,$rbacadmin,$ilLog;
                
                // check mode: restore
                if ($this->mode["restore"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\nrestoreMissingObjects:");

                if ($a_missing_objects === NULL and isset($this->missing_objects))
                {
                        $a_missing_objects = $this->missing_objects;
                }

                // handle wrong input
                if (!is_array($a_missing_objects)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                // no missing objects found. do nothing
                if (count($a_missing_objects) == 0)
                {
                        $this->writeScanLogLine("none");
                        return false;
                }
                
/*******************
restore starts here
********************/

                $restored = false;
                
                $message = sprintf('%s::restoreMissingObjects(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                foreach ($a_missing_objects as $missing_obj)
                {
                        // restore ref_id in case of missing
                        if ($missing_obj["ref_id"] === NULL)
                        {
                                $missing_obj["ref_id"] = $this->restoreReference($missing_obj["obj_id"]);

                                $this->writeScanLogLine("Created missing reference '".$missing_obj["ref_id"]."' for object '".$missing_obj["obj_id"]."'");
                        }

                        // put in tree under RecoveryFolder if not on exclude list
                        if (!in_array($missing_obj["type"],$this->object_types_exclude))
                        {
                                $rbacadmin->revokePermission($missing_obj["ref_id"]);
                                $obj_data =& $ilias->obj_factory->getInstanceByRefId($missing_obj["ref_id"]);
                                $obj_data->putInTree(RECOVERY_FOLDER_ID);
                                $obj_data->setPermissions(RECOVERY_FOLDER_ID);
                                $obj_data->initDefaultRoles();
                                unset($obj_data);
                                //$tree->insertNode($missing_obj["ref_id"],RECOVERY_FOLDER_ID);
                                $restored = true;
                                $this->writeScanLogLine("Restored object '".$missing_obj["title"]."' (id=".$missing_obj["obj_id"].",ref=".$missing_obj["ref_id"].") in 'Restored objects folder'");
                        }
                        
                        // TODO: process rolefolders
                }
                
                return $restored;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::restoreReference ( a_obj_id  ) 

restore a reference for an object Creates a new reference entry in DB table object_reference for $a_obj_id

Parameters:
integer obj_id private
Returns:
integer/boolean generated ref_id or false on error
See also:
this::restoreMissingObjects()

Definition at line 1345 of file class.ilValidator.php.

References $ilLog, and $q.

Referenced by removeInvalidRolefolders(), and restoreMissingObjects().

        {
                global $ilLog;

                if (empty($a_obj_id))
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }
                
                $q = "INSERT INTO object_reference (ref_id,obj_id) VALUES ('0','".$a_obj_id."')";
                $this->db->query($q);

                $message = sprintf('%s::restoreReference(): new reference %s for obj_id %s created',
                                                   get_class($this),
                                                   $this->db->getLastInsertId(),
                                                   $_obj_id);
                $ilLog->write($message,$ilLog->WARNING);

                return $this->db->getLastInsertId();
        }

Here is the caller graph for this function:

ilValidator::restoreSubTrees ( a_nodes  ) 

Restore objects (and their subobjects) to RecoveryFolder.

private

Parameters:
array list of nodes
Returns:
boolean false on error or restore mode disabled
See also:
this::restoreUnboundObjects()

Definition at line 1534 of file class.ilValidator.php.

References $ilias, $ilLog, $key, $rbacadmin, $tree, findInvalidChilds(), removeInvalidChilds(), and writeScanLogLine().

Referenced by restoreUnboundObjects().

        {
                global $tree,$rbacadmin,$ilias,$ilLog;
                
                // handle wrong input
                if (!is_array($a_nodes)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                // no invalid parents found. do nothing
                if (count($a_nodes) == 0)
                {
                        $this->writeScanLogLine("none");
                        return false;
                }
                
/*******************
restore starts here
********************/

                $subnodes = array();
                $topnode = array();

                $message = sprintf('%s::restoreSubTrees(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                // process move subtree
                foreach ($a_nodes as $node)
                {
                        // get node data
                        $topnode = $tree->getNodeData($node["child"]);
                        
                        // don't save rolefolders, remove them
                        // TODO process ROLE_FOLDER_ID
                        if ($topnode["type"] == "rolf")
                        {
                                $rolfObj = $ilias->obj_factory->getInstanceByRefId($topnode["child"]);
                                $rolfObj->delete();
                                unset($top_node);
                                unset($rolfObj);
                                continue;
                        }

                        // get subnodes of top nodes
                        $subnodes[$node["child"]] = $tree->getSubtree($topnode);
                
                        // delete old tree entries
                        $tree->deleteTree($topnode);
                }

                // now move all subtrees to new location
                // TODO: this whole put in place again stuff needs revision. Permission settings get lost.
                foreach ($subnodes as $key => $subnode)
                {

                        // first paste top_node ...
                        $rbacadmin->revokePermission($key);
                        $obj_data =& $ilias->obj_factory->getInstanceByRefId($key);
                        $obj_data->putInTree(RECOVERY_FOLDER_ID);
                        $obj_data->setPermissions(RECOVERY_FOLDER_ID);
                        $obj_data->initDefaultRoles();
                        
                        $this->writeScanLogLine("Object '".$obj_data->getId()."' restored.");

                        // ... remove top_node from list ...
                        array_shift($subnode);
                        
                        // ... insert subtree of top_node if any subnodes exist
                        if (count($subnode) > 0)
                        {
                                foreach ($subnode as $node)
                                {
                                        $rbacadmin->revokePermission($node["child"]);
                                        $obj_data =& $ilias->obj_factory->getInstanceByRefId($node["child"]);
                                        $obj_data->putInTree($node["parent"]);
                                        $obj_data->setPermissions($node["parent"]);
                                        $obj_data->initDefaultRoles();
                                        
                                        $this->writeScanLogLine("Object '".$obj_data->getId()."' restored.");
                                }
                        }
                }

                // final clean up
                $this->findInvalidChilds();
                $this->removeInvalidChilds();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::restoreTrash ( a_deleted_objects = NULL  ) 

Restore all objects in trash to RecoveryFolder NOTE: All objects will be restored to top of RecoveryFolder regardless of existing hierarchical structure!

public

Parameters:
array list of deleted childs (optional)
Returns:
boolean false on error or restore mode disabled
See also:
this::findDeletedObjects()

Definition at line 1418 of file class.ilValidator.php.

References $ilLog, $q, restoreDeletedObjects(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilLog;

                // check mode: restore
                if ($this->mode["restore_trash"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\nrestoreTrash:");
        
                if ($a_deleted_objects === NULL and isset($this->deleted_objects))
                {
                        $a_deleted_objects = $this->deleted_objects;
                }

                // handle wrong input
                if (!is_array($a_deleted_objects)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                $message = sprintf('%s::restoreTrash(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
        
                // start restore process
                $restored = $this->restoreDeletedObjects($a_deleted_objects);
                
                if ($restored)
                {
                        $q = "DELETE FROM tree WHERE tree!=1";
                        $this->db->query($q);

                        $message = sprintf('%s::restoreTrash(): Removed all trees with tree id <> 1',
                                                           get_class($this));
                        $ilLog->write($message,$ilLog->WARNING);
                
                        $this->writeScanLogLine("Old tree entries removed");
                }
                
                return $restored;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::restoreUnboundObjects ( a_unbound_objects = NULL  ) 

Restore objects (and their subobjects) to RecoveryFolder that are valid but not linked correctly in the hierarchy because they point to an invalid parent_id.

public

Parameters:
array list of childs with invalid parents (optional)
Returns:
boolean false on error or restore mode disabled
See also:
this::findUnboundObjects()
this::restoreSubTrees()

Definition at line 1377 of file class.ilValidator.php.

References $ilLog, restoreSubTrees(), and writeScanLogLine().

Referenced by validate().

        {
                global $ilLog;

                // check mode: restore
                if ($this->mode["restore"] !== true)
                {
                        return false;
                }

                $this->writeScanLogLine("\nrestoreUnboundObjects:");

                if ($a_unbound_objects === NULL and isset($this->unbound_objects))
                {
                        $a_unbound_objects = $this->unbound_objects;
                }

                // handle wrong input
                if (!is_array($a_unbound_objects)) 
                {
                        $this->throwError(INVALID_PARAM, WARNING, DEBUG);
                        return false;
                }

                $message = sprintf('%s::restoreUnboundObjects(): Started...',
                                                   get_class($this));
                $ilLog->write($message,$ilLog->WARNING);
                
                // start restore process
                return $this->restoreSubTrees($a_unbound_objects);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::setMode ( a_mode,
a_value 
)

set mode of ilValidator Usage: setMode("restore",true) => enable object restorey setMode("all",true) => enable all features For all possible modes see variables declaration

public

Parameters:
string mode
boolean value (true=enable/false=disable)
Returns:
boolean false on error

Definition at line 167 of file class.ilValidator.php.

References $mode, and setModeDependencies().

        {
                if ((!in_array($a_mode,array_keys($this->mode)) and $a_mode != "all") or !is_bool($a_value))
                {
                        $this->throwError(INVALID_PARAM, FATAL, DEBUG);
                        return false;
                }
                
                if ($a_mode == "all")
                {
                        foreach ($this->mode as $mode => $value)
                        {
                                $this->mode[$mode] = $a_value;
                        }
                }
                else
                {
                        $this->mode[$a_mode] = $a_value;
                }
                
                // consider mode dependencies
                $this->setModeDependencies();

                return true;
        }

Here is the call graph for this function:

ilValidator::setModeDependencies (  ) 

Sets modes by considering mode dependencies; some modes require other modes to be activated.

This functions set all modes that are required according to the current setting.

private

See also:
this::setMode()

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

Referenced by setMode().

        {
                // DO NOT change the order
                
                if ($this->mode["restore"] === true)
                {
                        $this->mode["scan"] = true;
                        $this->mode["purge"] = false;
                }

                if ($this->mode["purge"] === true)
                {
                        $this->mode["scan"] = true;
                        $this->mode["restore"] = false;
                }

                if ($this->mode["restore_trash"] === true)
                {
                        $this->mode["scan"] = true;
                        $this->mode["purge_trash"] = false;
                }

                if ($this->mode["purge_trash"] === true)
                {
                        $this->mode["scan"] = true;
                        $this->mode["restore_trash"] = false;
                }

                if ($this->mode["clean"] === true)
                {
                        $this->mode["scan"] = true;
                }
        }

Here is the caller graph for this function:

ilValidator::validate (  ) 

Performs the validation for each enabled mode.

Returns a validation summary for display to the user.

Returns:
string Validation summary. public
See also:
this::setMode()

Definition at line 267 of file class.ilValidator.php.

References $lng, $mode, checkTreeStructure(), dumpTree(), findDeletedObjects(), findInvalidChilds(), findInvalidReferences(), findInvalidRolefolders(), findMissingObjects(), findUnboundObjects(), getDeletedObjects(), getInvalidChilds(), getInvalidReferences(), getInvalidRolefolders(), getMissingObjects(), getUnboundObjects(), initGapsInTree(), isModeEnabled(), purgeMissingObjects(), purgeTrash(), purgeUnboundObjects(), removeInvalidChilds(), removeInvalidReferences(), removeInvalidRolefolders(), restoreMissingObjects(), restoreTrash(), and restoreUnboundObjects().

        {
                global $lng;
                
                // The validation summary.
                $summary = "";


                // STEP 1: Scan
                // -------------------
                $summary .= $lng->txt("scanning_system");
                if (!$this->isModeEnabled("scan"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        $summary .= "<br/>".$lng->txt("searching_invalid_refs");
                        if ($this->findInvalidReferences())
                        {
                                $summary .= count($this->getInvalidReferences())." ".$lng->txt("found");
                        }
                        else
                        {
                                $summary .= $lng->txt("found_none");
                        }
                        
                        $summary .= "<br/>".$lng->txt("searching_invalid_childs");
                        if ($this->findInvalidChilds())
                        {
                                $summary .= count($this->getInvalidChilds())." ".$lng->txt("found");

                        }
                        else
                        {
                                $summary .= $lng->txt("found_none");
                        }
                        
                        $summary .= "<br/>".$lng->txt("searching_missing_objs");
                        if ($this->findMissingObjects())
                        {
                                $summary .= count($this->getMissingObjects())." ".$lng->txt("found");

                        }
                        else
                        {
                                $summary .= $lng->txt("found_none");
                        }
                
                        $summary .= "<br/>".$lng->txt("searching_unbound_objs");
                        if ($this->findUnboundObjects())
                        {
                                $summary .=  count($this->getUnboundObjects())." ".$lng->txt("found");

                        }
                        else
                        {
                                $summary .= $lng->txt("found_none");
                        }
                
                        $summary .= "<br/>".$lng->txt("searching_deleted_objs");
                        if ($this->findDeletedObjects())
                        {
                                $summary .= count($this->getDeletedObjects())." ".$lng->txt("found");

                        }
                        else
                        {
                                $summary .= $lng->txt("found_none");
                        }

                        $summary .= "<br/>".$lng->txt("searching_invalid_rolfs");
                        if ($this->findInvalidRolefolders())
                        {
                                $summary .= count($this->getInvalidRolefolders())." ".$lng->txt("found");

                        }
                        else
                        {
                                $summary .= $lng->txt("found_none");
                        }
                        
                        $summary .= "<br/><br/>".$lng->txt("analyzing_tree_structure");
                        if ($this->checkTreeStructure())
                        {
                                $summary .= $lng->txt("tree_corrupt");
                        }
                        else
                        {
                                $summary .= $lng->txt("disabled");
                        }
                }
                
                // STEP 2: Dump tree
                // -------------------
                $summary .= "<br /><br />".$lng->txt("dumping_tree");
                if (!$this->isModeEnabled("dump_tree"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        $error_count = $this->dumpTree();
                        if ($error_count > 0)
                        {
                                $summary .= $lng->txt("tree_corrupt");
                        }
                        else
                        {
                                $summary .= $lng->txt("done");
                        }
                }

                // STEP 3: Clean Up
                // -------------------
                $summary .= "<br /><br />".$lng->txt("cleaning");
                if (!$this->isModeEnabled("clean"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        $summary .= "<br />".$lng->txt("removing_invalid_refs");
                        if ($this->removeInvalidReferences())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_remove").$lng->txt("skipped");
                        }
                        
                        $summary .= "<br />".$lng->txt("removing_invalid_childs");
                        if ($this->removeInvalidChilds())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_remove").$lng->txt("skipped");
                        }

                        $summary .= "<br />".$lng->txt("removing_invalid_rolfs");
                        if ($this->removeInvalidRolefolders())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_remove").$lng->txt("skipped");
                        }

                        // find unbound objects again AFTER cleaning process!
                        // This updates the array 'unboundobjects' required for the further steps
                        // There might be other objects unbounded now due to removal of object_data/reference entries.
                        $this->findUnboundObjects();
                }

                // STEP 4: Restore objects
                $summary .= "<br /><br />".$lng->txt("restoring");
                
                if (!$this->isModeEnabled("restore"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        $summary .= "<br />".$lng->txt("restoring_missing_objs");
                        if ($this->restoreMissingObjects())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_restore").$lng->txt("skipped");
                        }
                        
                        $summary .= "<br />".$lng->txt("restoring_unbound_objs");
                        if ($this->restoreUnboundObjects())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_restore").$lng->txt("skipped");
                        }
                }
                
                // STEP 5: Restoring Trash
                $summary .= "<br /><br />".$lng->txt("restoring_trash");

                if (!$this->isModeEnabled("restore_trash"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        if ($this->restoreTrash())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_restore").$lng->txt("skipped");
                        }
                }
                
                // STEP 6: Purging...
                $summary .= "<br /><br />".$lng->txt("purging");
                
                if (!$this->isModeEnabled("purge"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        $summary .= "<br />".$lng->txt("purging_missing_objs");
                        if ($this->purgeMissingObjects())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_purge").$lng->txt("skipped");
                        }

                        $summary .= "<br />".$lng->txt("purging_unbound_objs");
                        if ($this->purgeUnboundObjects())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_purge").$lng->txt("skipped");
                        }
                }

                // STEP 7: Purging trash...
                $summary .= "<br /><br />".$lng->txt("purging_trash");
                
                if (!$this->isModeEnabled("purge_trash"))
                {
                        $summary .= $lng->txt("disabled");
                }
                else
                {
                        if ($this->purgeTrash())
                        {
                                $summary .= strtolower($lng->txt("done"));
                        }
                        else
                        {
                                $summary .= $lng->txt("nothing_to_purge").$lng->txt("skipped");
                        }
                }
                
                // STEP 8: Initialize gaps in tree
                if ($this->isModeEnabled("clean"))
                {
                        $summary .= "<br /><br />".$lng->txt("cleaning_final");
                        if ($this->initGapsInTree())
                        {
                                $summary .= "<br />".$lng->txt("initializing_gaps")." ".strtolower($lng->txt("done"));
                        }
                }
                
                // check RBAC starts here
                // ...
                
                // le fin
                foreach ($this->mode as $mode => $value)
                {
                        $arr[] = $mode."[".(int)$value."]";
                }
                
                return $summary;
        }

Here is the call graph for this function:

ilValidator::writeScanLogArray ( a_arr  ) 

Definition at line 1886 of file class.ilValidator.php.

References isLogEnabled().

Referenced by findDeletedObjects(), findInvalidChilds(), findInvalidRBACEntries(), findInvalidReferences(), findInvalidRolefolders(), findMissingObjects(), and findUnboundObjects().

        {
                if (!$this->isLogEnabled())
                {
                        return false;
                }
                
                foreach ($a_arr as $entry)
                {
                        $this->scan_log->write(implode("\t",$entry));           
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilValidator::writeScanLogLine ( a_msg  ) 

Field Documentation

ilValidator::$deleted_objects = array()

Definition at line 93 of file class.ilValidator.php.

ilValidator::$invalid_childs = array()

Definition at line 75 of file class.ilValidator.php.

ilValidator::$invalid_objects = array()

Definition at line 107 of file class.ilValidator.php.

ilValidator::$invalid_references = array()

Definition at line 69 of file class.ilValidator.php.

ilValidator::$invalid_rolefolders = array()

Definition at line 101 of file class.ilValidator.php.

ilValidator::$logging = false

Definition at line 113 of file class.ilValidator.php.

ilValidator::$missing_objects = array()

Definition at line 81 of file class.ilValidator.php.

ilValidator::$mode
Initial value:
 array(
                                                "scan"                  => true,                
                                                "dump_tree"             => false,               
                                                "clean"                 => false,               
                                                "restore"               => false,               
                                                "purge"                 => false,               
                                                "restore_trash" => false,               
                                                "purge_trash"   => false                
                                        )

Definition at line 55 of file class.ilValidator.php.

Referenced by setMode(), and validate().

ilValidator::$object_types_exclude
Initial value:
 array("adm","root","mail","usrf","objf","lngf",
                "trac","taxf","auth","rolf","file","assf","extt","adve","fold")

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

ilValidator::$rbac_object_types = NULL

Definition at line 38 of file class.ilValidator.php.

ilValidator::$scan_log

Definition at line 119 of file class.ilValidator.php.

Referenced by readScanLog().

ilValidator::$scan_log_file = "scanlog.log"

Definition at line 121 of file class.ilValidator.php.

ilValidator::$scan_log_separator = "<!-- scan log start -->"

Definition at line 123 of file class.ilValidator.php.

ilValidator::$unbound_objects = array()

Definition at line 87 of file class.ilValidator.php.


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