Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Public Member Functions | |
__construct ($name) | |
Creates one new xmldb_structure. More... | |
addTable ($table, $after=null) | |
Add one table to the structure, allowing to specify the desired order If it's not specified, then the table is added at the end. More... | |
arr2xmldb_structure ($xmlarr) | |
Load data from XML to the structure. More... | |
calculateHash ($recursive=false) | |
This function calculate and set the hash of one xmldb_structure. More... | |
checkName () | |
This function will check if one key name is ok or no (true/false) only lowercase a-z, 0-9 and _ are allowed. More... | |
checkNameValues ($arr) | |
This function will check that all the elements in one array have a correct name [a-z0-9_]. More... | |
comma2array ($string) | |
Returns one array of elements from one comma separated string, supporting quoted strings containing commas and concat function calls. More... | |
debug ($message) | |
This function will perform the central debug of all the XMLDB classes being called automatically every time one error is found. More... | |
deleteTable ($tablename) | |
Delete one table from the Structure. More... | |
findObjectInArray ($objectname, $arr) | |
Returns the position of one object in the array. More... | |
findTableInArray ($tablename) | |
Returns the position of one table in the array. More... | |
fixPrevNext (&$arr) | |
Reconstruct previous/next attributes. More... | |
getAllErrors () | |
This function will return all the errors found in one structure looking recursively inside each table. More... | |
getComment () | |
This function returns the comment of one xmldb_object. More... | |
getError () | |
This function will return the error detected in the object. More... | |
getFieldUses ($tablename, $fieldname) | |
This function returns the number of uses of one field inside a whole xmldb_structure. More... | |
getHash () | |
This function returns the hash of one xmldb_object. More... | |
getIndexUses ($tablename, $indexname) | |
This function returns the number of uses of one index inside a whole xmldb_structure. More... | |
getKeyUses ($tablename, $keyname) | |
This function returns the number of uses of one key inside a whole xmldb_structure. More... | |
getName () | |
This function will return the name of the xmldb_object. More... | |
getNext () | |
This function will return the name of the next xmldb_object. More... | |
getPath () | |
Returns the path of the structure. More... | |
getPrevious () | |
This function will return the name of the previous xmldb_object. More... | |
getTable ($tablename) | |
Returns one xmldb_table. More... | |
getTables () | |
Returns the tables of the structure. More... | |
getTableUses ($tablename) | |
This function returns the number of uses of one table inside a whole XMLDStructure. More... | |
getVersion () | |
Returns the version of the structure. More... | |
hasChanged () | |
This function returns true/false, if the xmldb_object has changed. More... | |
isLoaded () | |
This function returns true/false, if the xmldb_object has been loaded. More... | |
orderElements ($arr) | |
This function will order all the elements in one array, following the previous/next rules. More... | |
orderTables () | |
This function will reorder the array of tables. More... | |
readableInfo () | |
This function will display a readable info about the xmldb_object (should be implemented inside each XMLDBxxx object) More... | |
setChanged ($changed=true) | |
This function will set the changed field of the xmldb_object. More... | |
setComment ($comment) | |
This function will set the comment of the xmldb_object. More... | |
setHash ($hash) | |
This function will set the hash of the xmldb_object. More... | |
setLoaded ($loaded=true) | |
This function will set the loaded field of the xmldb_object. More... | |
setName ($name) | |
This function will set the name field of the xmldb_object. More... | |
setNext ($next) | |
This function will set the next of the xmldb_object. More... | |
setPrevious ($previous) | |
This function will set the previous of the xmldb_object. More... | |
setTables ($tables) | |
Set the tables. More... | |
setVersion ($version) | |
Set the structure version. More... | |
validateDefinition (xmldb_table $xmldb_table=null) | |
Validates the definition of objects and returns error message. More... | |
xmlOutput () | |
This function will output the XML text for one structure. More... | |
Protected Attributes | |
bool | $changed |
was object changed | |
string | $comment |
comment on object | |
string | $errormsg |
error message | |
string | $hash |
hash of object | |
bool | $loaded |
is it loaded yet | |
string | $name |
name of obejct | |
xmldb_object | $next |
string | $path |
xmldb_object | $previous |
array | $tables |
tables | |
string | $version |
xmldb_structure::__construct | ( | $name | ) |
xmldb_structure::addTable | ( | $table, | |
$after = null |
|||
) |
Add one table to the structure, allowing to specify the desired order If it's not specified, then the table is added at the end.
xmldb_table | $table | |
mixed | $after |
xmldb_structure::arr2xmldb_structure | ( | $xmlarr | ) |
Load data from XML to the structure.
array | $xmlarr |
bool |
xmldb_structure::calculateHash | ( | $recursive = false | ) |
This function calculate and set the hash of one xmldb_structure.
bool | $recursive |
|
inherited |
This function will check if one key name is ok or no (true/false) only lowercase a-z, 0-9 and _ are allowed.
bool |
|
inherited |
This function will check that all the elements in one array have a correct name [a-z0-9_].
array | $arr |
bool |
|
inherited |
Returns one array of elements from one comma separated string, supporting quoted strings containing commas and concat function calls.
string | $string |
array |
|
inherited |
This function will perform the central debug of all the XMLDB classes being called automatically every time one error is found.
Apart from the main actions performed in it (XMLDB agnostic) it looks for one function called xmldb_debug() and invokes it, passing both the message code and the whole object. So, to perform custom debugging just add such function to your libs.
Call to the external hook function can be disabled by request by defining XMLDB_SKIP_DEBUG_HOOK
string | $message |
xmldb_structure::deleteTable | ( | $tablename | ) |
Delete one table from the Structure.
string | $tablename |
|
inherited |
Returns the position of one object in the array.
string | $objectname | |
array | $arr |
mixed |
xmldb_structure::findTableInArray | ( | $tablename | ) |
Returns the position of one table in the array.
string | $tablename |
mixed |
|
inherited |
Reconstruct previous/next attributes.
array | $arr |
bool | true if $arr modified |
xmldb_structure::getAllErrors | ( | ) |
This function will return all the errors found in one structure looking recursively inside each table.
Returns an array of errors or false
mixed |
|
inherited |
This function returns the comment of one xmldb_object.
string |
|
inherited |
This function will return the error detected in the object.
string |
xmldb_structure::getFieldUses | ( | $tablename, | |
$fieldname | |||
) |
This function returns the number of uses of one field inside a whole xmldb_structure.
Useful to detect if the field must be locked. Return false if no uses are found.
string | $tablename | |
string | $fieldname |
mixed |
|
inherited |
This function returns the hash of one xmldb_object.
string |
xmldb_structure::getIndexUses | ( | $tablename, | |
$indexname | |||
) |
This function returns the number of uses of one index inside a whole xmldb_structure.
Useful to detect if the index must be locked. Return false if no uses are found.
string | $tablename | |
string | $indexname |
mixed |
xmldb_structure::getKeyUses | ( | $tablename, | |
$keyname | |||
) |
This function returns the number of uses of one key inside a whole xmldb_structure.
Useful to detect if the key must be locked. Return false if no uses are found.
string | $tablename | |
string | $keyname |
mixed |
|
inherited |
This function will return the name of the xmldb_object.
string |
|
inherited |
This function will return the name of the next xmldb_object.
xmldb_object |
xmldb_structure::getPath | ( | ) |
Returns the path of the structure.
string |
|
inherited |
This function will return the name of the previous xmldb_object.
xmldb_object |
xmldb_structure::getTable | ( | $tablename | ) |
xmldb_structure::getTables | ( | ) |
Returns the tables of the structure.
array |
xmldb_structure::getTableUses | ( | $tablename | ) |
This function returns the number of uses of one table inside a whole XMLDStructure.
Useful to detect if the table must be locked. Return false if no uses are found.
string | $tablename |
mixed |
xmldb_structure::getVersion | ( | ) |
Returns the version of the structure.
string |
|
inherited |
This function returns true/false, if the xmldb_object has changed.
bool |
|
inherited |
This function returns true/false, if the xmldb_object has been loaded.
bool |
|
inherited |
This function will order all the elements in one array, following the previous/next rules.
array | $arr |
array|bool |
xmldb_structure::orderTables | ( | ) |
This function will reorder the array of tables.
bool | success |
|
inherited |
This function will display a readable info about the xmldb_object (should be implemented inside each XMLDBxxx object)
string |
Reimplemented in xmldb_field, xmldb_index, and xmldb_key.
|
inherited |
This function will set the changed field of the xmldb_object.
bool | $changed |
|
inherited |
This function will set the comment of the xmldb_object.
string | $comment |
|
inherited |
This function will set the hash of the xmldb_object.
string | $hash |
|
inherited |
This function will set the loaded field of the xmldb_object.
bool | $loaded |
|
inherited |
This function will set the name field of the xmldb_object.
string | $name |
|
inherited |
This function will set the next of the xmldb_object.
xmldb_object | $next |
|
inherited |
This function will set the previous of the xmldb_object.
xmldb_object | $previous |
xmldb_structure::setTables | ( | $tables | ) |
Set the tables.
array | $tables |
xmldb_structure::setVersion | ( | $version | ) |
Set the structure version.
string | version |
|
inherited |
Validates the definition of objects and returns error message.
The error message should not be localised because it is intended for developers, end users and admins should never see these problems!
xmldb_table | $xmldb_table | optional when object is table |
string | null if ok, error message if problem found |
Reimplemented in xmldb_field, xmldb_index, and xmldb_table.
xmldb_structure::xmlOutput | ( | ) |
This function will output the XML text for one structure.
string |