ILIAS
Release_5_0_x_branch Revision 61816
|
ILIAS Data Validator & Recovery Tool. More...
Public Member Functions | |
ilValidator ($a_log=false) | |
Constructor. | |
getPossibleModes () | |
get possible ilValidator modes public | |
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. | |
deleteScanLog () | |
Delete scan log. | |
readScanLog () | |
get_last_scan ($a_scan_log) | |
checkTreeStructure ($a_startnode=null) | |
dumpTree () | |
Dumps the Tree structure into the scan log. | |
Public Member Functions inherited from PEAR | |
PEAR ($error_class=null) | |
Constructor. | |
_PEAR () | |
Destructor (the emulated type of...). | |
& | getStaticProperty ($class, $var) |
If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. | |
registerShutdownFunc ($func, $args=array()) | |
Use this function to register a shutdown method for static classes. | |
isError ($data, $code=null) | |
Tell whether a value is a PEAR error. | |
setErrorHandling ($mode=null, $options=null) | |
Sets how errors generated by this object should be handled. | |
expectError ($code= '*') | |
This method is used to tell which errors you expect to get. | |
popExpect () | |
This method pops one element off the expected error codes stack. | |
_checkDelExpect ($error_code) | |
This method checks unsets an error code if available. | |
delExpect ($error_code) | |
This method deletes all occurences of the specified element from the expected error codes stack. | |
& | raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false) |
This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. | |
& | throwError ($message=null, $code=null, $userinfo=null) |
Simpler form of raiseError with fewer options. | |
staticPushErrorHandling ($mode, $options=null) | |
staticPopErrorHandling () | |
pushErrorHandling ($mode, $options=null) | |
Push a new error handler on top of the error handler options stack. | |
popErrorHandling () | |
Pop the last error handler used. | |
loadExtension ($ext) | |
OS independant PHP extension load. |
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 -->" | |
Data Fields inherited from PEAR | |
$_debug = false | |
$_default_error_mode = null | |
$_default_error_options = null | |
$_default_error_handler = '' | |
$_error_class = 'PEAR_Error' | |
$_expected_errors = array() |
Protected Member Functions | |
isMediaFolder ($a_obj_id) | |
isExcludedFromRecovery ($a_type, $a_obj_id) | |
Check if type is excluded from recovery. | |
initWorkspaceObjects () | |
filterWorkspaceObjects (array &$a_data, $a_index="obj_id") |
Protected Attributes | |
$media_pool_ids = null |
ILIAS Data Validator & Recovery Tool.
Definition at line 11 of file class.ilValidator.php.
ilValidator::checkTreeStructure | ( | $a_startnode = null | ) |
Definition at line 2046 of file class.ilValidator.php.
References writeScanLogLine().
Referenced by validate().
ilValidator::deleteScanLog | ( | ) |
Delete scan log.
Definition at line 2010 of file class.ilValidator.php.
Referenced by ilValidator().
ilValidator::dumpTree | ( | ) |
Dumps the Tree structure into the scan log.
public
Definition at line 2061 of file class.ilValidator.php.
References $ilDB, $row, DB_FETCHMODE_OBJECT, initWorkspaceObjects(), isMediaFolder(), and writeScanLogLine().
Referenced by validate().
|
protected |
Definition at line 2542 of file class.ilValidator.php.
References initWorkspaceObjects().
Referenced by findInvalidRBACEntries(), findInvalidReferences(), findInvalidRolefolders(), findMissingObjects(), removeInvalidReferences(), removeInvalidRolefolders(), and restoreMissingObjects().
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
Definition at line 991 of file class.ilValidator.php.
References $query, $row, DB_FETCHMODE_OBJECT, IL_CAL_DATETIME, IL_CAL_UNIX, writeScanLogArray(), and writeScanLogLine().
Referenced by validate().
ilValidator::findInvalidChilds | ( | ) |
Search database for all tree entries without any link to a valid object and stores result in $this->invalid_childs.
public
Definition at line 871 of file class.ilValidator.php.
References $ilDB, $row, DB_FETCHMODE_OBJECT, writeScanLogArray(), and writeScanLogLine().
Referenced by purgeObjects(), restoreSubTrees(), and validate().
ilValidator::findInvalidRBACEntries | ( | ) |
Search database for all role entries that are linked to invalid ref_ids.
public
Definition at line 709 of file class.ilValidator.php.
References $ilDB, $row, DB_FETCHMODE_OBJECT, filterWorkspaceObjects(), writeScanLogArray(), and writeScanLogLine().
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
Definition at line 808 of file class.ilValidator.php.
References $ilDB, $row, DB_FETCHMODE_OBJECT, filterWorkspaceObjects(), writeScanLogArray(), and writeScanLogLine().
Referenced by validate().
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
Definition at line 627 of file class.ilValidator.php.
References $ilDB, $row, DB_FETCHMODE_OBJECT, filterWorkspaceObjects(), writeScanLogArray(), and writeScanLogLine().
Referenced by validate().
ilValidator::findMissingObjects | ( | ) |
Search database for all object entries with missing reference and/or tree entry and stores result in $this->missing_objects.
public
Definition at line 555 of file class.ilValidator.php.
References $ilDB, $row, DB_FETCHMODE_OBJECT, filterWorkspaceObjects(), isExcludedFromRecovery(), writeScanLogArray(), and writeScanLogLine().
Referenced by validate().
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
Definition at line 935 of file class.ilValidator.php.
References $row, DB_FETCHMODE_OBJECT, writeScanLogArray(), and writeScanLogLine().
Referenced by validate().
ilValidator::get_last_scan | ( | $a_scan_log | ) |
Definition at line 2034 of file class.ilValidator.php.
Referenced by readScanLog().
ilValidator::getDeletedObjects | ( | ) |
Gets all object in trash.
public
Definition at line 1068 of file class.ilValidator.php.
References $deleted_objects.
Referenced by validate().
ilValidator::getInvalidChilds | ( | ) |
Gets all tree entries without any link to a valid object.
public
Definition at line 919 of file class.ilValidator.php.
References $invalid_childs.
Referenced by validate().
ilValidator::getInvalidReferences | ( | ) |
Gets all reference entries that are not linked with a valid object id.
public
Definition at line 857 of file class.ilValidator.php.
References $invalid_references.
Referenced by validate().
ilValidator::getInvalidRolefolders | ( | ) |
Gets invalid rolefolders (same as missing objects)
public
Definition at line 1081 of file class.ilValidator.php.
References $invalid_rolefolders.
Referenced by validate().
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
Definition at line 794 of file class.ilValidator.php.
References $missing_objects.
Referenced by validate().
ilValidator::getPossibleModes | ( | ) |
get possible ilValidator modes public
Definition at line 151 of file class.ilValidator.php.
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
Definition at line 1057 of file class.ilValidator.php.
References $unbound_objects.
Referenced by validate().
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
object | PEAR_error |
Definition at line 1910 of file class.ilValidator.php.
References exit.
ilValidator::hasScanLog | ( | ) |
Quickly determine if there is a scan log.
Definition at line 2001 of file class.ilValidator.php.
Referenced by readScanLog().
ilValidator::ilValidator | ( | $a_log = false | ) |
Constructor.
public
integer | mode |
Definition at line 116 of file class.ilValidator.php.
References $ilDB, deleteScanLog(), PEAR\PEAR(), PEAR_ERROR_CALLBACK, PEAR\setErrorHandling(), and writeScanLogLine().
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() @access public @return boolean false if clean mode disabled @see ilTree::renumber()
Definition at line 1879 of file class.ilValidator.php.
References $ilLog, and writeScanLogLine().
Referenced by validate().
|
protected |
Definition at line 2518 of file class.ilValidator.php.
Referenced by dumpTree(), and filterWorkspaceObjects().
|
protected |
Check if type is excluded from recovery.
string | $a_type | |
int | $a_obj_id |
Definition at line 2505 of file class.ilValidator.php.
References isMediaFolder().
Referenced by findMissingObjects(), and restoreMissingObjects().
ilValidator::isLogEnabled | ( | ) |
Definition at line 212 of file class.ilValidator.php.
References $logging.
Referenced by writeScanLogArray(), and writeScanLogLine().
|
protected |
Definition at line 2481 of file class.ilValidator.php.
References $ilDB, $query, $res, and $row.
Referenced by dumpTree(), and isExcludedFromRecovery().
ilValidator::isModeEnabled | ( | $a_mode | ) |
Is a particular mode enabled?
public
string | mode to query |
Definition at line 201 of file class.ilValidator.php.
References PEAR\throwError().
Referenced by validate().
ilValidator::purgeMissingObjects | ( | $a_nodes = NULL | ) |
Removes all missing objects from system.
public
array | list of nodes to delete |
Definition at line 1745 of file class.ilValidator.php.
References $ilLog, $missing_objects, purgeObjects(), and writeScanLogLine().
Referenced by validate().
ilValidator::purgeObjects | ( | $a_nodes | ) |
removes objects from system
private
array | list of objects |
Definition at line 1777 of file class.ilValidator.php.
References $ilLog, $ref_id, ilTree\_removeEntry(), findInvalidChilds(), removeInvalidChilds(), PEAR\throwError(), and writeScanLogLine().
Referenced by purgeMissingObjects(), purgeTrash(), and purgeUnboundObjects().
ilValidator::purgeTrash | ( | $a_nodes = NULL | ) |
Removes all objects in trash from system.
public
array | list of nodes to delete |
Definition at line 1676 of file class.ilValidator.php.
References $deleted_objects, $ilLog, purgeObjects(), and writeScanLogLine().
Referenced by validate().
ilValidator::purgeUnboundObjects | ( | $a_nodes = NULL | ) |
Removes all invalid objects from system.
public
array | list of nodes to delete |
Definition at line 1711 of file class.ilValidator.php.
References $ilLog, $unbound_objects, purgeObjects(), and writeScanLogLine().
Referenced by validate().
ilValidator::readScanLog | ( | ) |
Definition at line 2015 of file class.ilValidator.php.
References $scan_log, get_last_scan(), and hasScanLog().
ilValidator::removeInvalidChilds | ( | $a_invalid_childs = NULL | ) |
Removes all tree entries without any link to a valid object.
public
array | invalid IDs in tree (optional) |
Definition at line 1163 of file class.ilValidator.php.
References $ilLog, $invalid_childs, PEAR\throwError(), and writeScanLogLine().
Referenced by purgeObjects(), restoreSubTrees(), and validate().
ilValidator::removeInvalidReferences | ( | $a_invalid_refs = NULL | ) |
Removes all reference entries that are linked with invalid object IDs.
public
array | invalid IDs in object_reference (optional) |
Definition at line 1095 of file class.ilValidator.php.
References $ilDB, $ilLog, $invalid_references, $query, $res, filterWorkspaceObjects(), PEAR\throwError(), and writeScanLogLine().
Referenced by validate().
ilValidator::removeInvalidRolefolders | ( | $a_invalid_rolefolders = NULL | ) |
Removes invalid rolefolders.
public
array | obj_ids of rolefolder objects (optional) |
Definition at line 1228 of file class.ilValidator.php.
References $ilLog, $invalid_rolefolders, filterWorkspaceObjects(), restoreReference(), PEAR\throwError(), and writeScanLogLine().
Referenced by validate().
ilValidator::restoreDeletedObjects | ( | $a_nodes | ) |
Restore deleted objects (and their subobjects) to RecoveryFolder.
private
array | list of nodes |
Definition at line 1515 of file class.ilValidator.php.
References $ilLog, PEAR\throwError(), and writeScanLogLine().
Referenced by restoreTrash().
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
array | obj_ids of missing objects (optional) |
Definition at line 1303 of file class.ilValidator.php.
References $ilLog, $missing_objects, filterWorkspaceObjects(), isExcludedFromRecovery(), restoreReference(), PEAR\throwError(), and writeScanLogLine().
Referenced by validate().
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
integer | obj_id private |
Definition at line 1386 of file class.ilValidator.php.
References $ilDB, $ilLog, $query, $res, and PEAR\throwError().
Referenced by removeInvalidRolefolders(), and restoreMissingObjects().
ilValidator::restoreSubTrees | ( | $a_nodes | ) |
Restore objects (and their subobjects) to RecoveryFolder.
private
array | list of nodes |
Definition at line 1576 of file class.ilValidator.php.
References $ilLog, findInvalidChilds(), removeInvalidChilds(), PEAR\throwError(), and writeScanLogLine().
Referenced by restoreUnboundObjects().
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
array | list of deleted childs (optional) |
Definition at line 1461 of file class.ilValidator.php.
References $deleted_objects, $ilLog, restoreDeletedObjects(), PEAR\throwError(), and writeScanLogLine().
Referenced by validate().
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
array | list of childs with invalid parents (optional) |
Definition at line 1420 of file class.ilValidator.php.
References $ilLog, $unbound_objects, restoreSubTrees(), PEAR\throwError(), and writeScanLogLine().
Referenced by validate().
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
string | mode |
boolean | value (true=enable/false=disable) |
Definition at line 167 of file class.ilValidator.php.
References $mode, setModeDependencies(), and PEAR\throwError().
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
Definition at line 225 of file class.ilValidator.php.
Referenced by setMode().
ilValidator::validate | ( | ) |
Performs the validation for each enabled mode.
Returns a validation summary for display to the user.
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().
ilValidator::writeScanLogArray | ( | $a_arr | ) |
Definition at line 1975 of file class.ilValidator.php.
References isLogEnabled().
Referenced by findDeletedObjects(), findInvalidChilds(), findInvalidRBACEntries(), findInvalidReferences(), findInvalidRolefolders(), findMissingObjects(), and findUnboundObjects().
ilValidator::writeScanLogLine | ( | $a_msg | ) |
Definition at line 1988 of file class.ilValidator.php.
References isLogEnabled().
Referenced by checkTreeStructure(), dumpTree(), findDeletedObjects(), findInvalidChilds(), findInvalidRBACEntries(), findInvalidReferences(), findInvalidRolefolders(), findMissingObjects(), findUnboundObjects(), ilValidator(), initGapsInTree(), purgeMissingObjects(), purgeObjects(), purgeTrash(), purgeUnboundObjects(), removeInvalidChilds(), removeInvalidReferences(), removeInvalidRolefolders(), restoreDeletedObjects(), restoreMissingObjects(), restoreSubTrees(), restoreTrash(), and restoreUnboundObjects().
ilValidator::$deleted_objects = array() |
Definition at line 78 of file class.ilValidator.php.
Referenced by getDeletedObjects(), purgeTrash(), and restoreTrash().
ilValidator::$invalid_childs = array() |
Definition at line 60 of file class.ilValidator.php.
Referenced by getInvalidChilds(), and removeInvalidChilds().
ilValidator::$invalid_objects = array() |
Definition at line 92 of file class.ilValidator.php.
ilValidator::$invalid_references = array() |
Definition at line 54 of file class.ilValidator.php.
Referenced by getInvalidReferences(), and removeInvalidReferences().
ilValidator::$invalid_rolefolders = array() |
Definition at line 86 of file class.ilValidator.php.
Referenced by getInvalidRolefolders(), and removeInvalidRolefolders().
ilValidator::$logging = false |
Definition at line 98 of file class.ilValidator.php.
Referenced by isLogEnabled().
|
protected |
Definition at line 13 of file class.ilValidator.php.
ilValidator::$missing_objects = array() |
Definition at line 66 of file class.ilValidator.php.
Referenced by getMissingObjects(), purgeMissingObjects(), and restoreMissingObjects().
ilValidator::$mode |
Definition at line 40 of file class.ilValidator.php.
Referenced by setMode(), and validate().
ilValidator::$object_types_exclude |
Definition at line 33 of file class.ilValidator.php.
ilValidator::$rbac_object_types = NULL |
Definition at line 19 of file class.ilValidator.php.
ilValidator::$scan_log |
Definition at line 104 of file class.ilValidator.php.
Referenced by readScanLog().
ilValidator::$scan_log_file = "scanlog.log" |
Definition at line 106 of file class.ilValidator.php.
ilValidator::$scan_log_separator = "<!-- scan log start -->" |
Definition at line 108 of file class.ilValidator.php.
ilValidator::$unbound_objects = array() |
Definition at line 72 of file class.ilValidator.php.
Referenced by getUnboundObjects(), purgeUnboundObjects(), and restoreUnboundObjects().