|
Moodle APIs 4.1
Moodle 4.1.9+ (Build: 20240402)
|
XML format importer class from file storage. More...
Public Member Functions | |
| __construct ($filepath, moodle_database $mdb, $check_schema=true) | |
| Object constructor. | |
| begin_database_import ($version, $timestamp) | |
| Callback function. | |
| begin_table_import ($tablename, $schemaHash) | |
| Callback function. | |
| finish_database_import () | |
| Callback function. | |
| finish_table_import ($tablename) | |
| Callback function. | |
| import_database () | |
| Common import method: it opens the file storage, creates the parser, feeds the XML parser with data, releases the parser and closes the file storage. | |
| import_table_data ($tablename, $data) | |
| Callback function. | |
| set_transaction_mode ($mode) | |
| How to use transactions during the import. | |
Protected Member Functions | |
| cdata ($parser, $data) | |
| Callback function. | |
| get_parser () | |
| Creates and setups a SAX parser. | |
| tag_close ($parser, $tag) | |
| Callback function. | |
| tag_open ($parser, $tag, $attributes) | |
| Callback function. | |
Protected Attributes | |
| bool | $check_schema |
| Boolean flag - whether or not to check that XML database schema matches the RDBMS database schema before importing (used by. | |
| $current_data | |
| $current_data_is_null | |
| $current_field | |
| $current_row | |
| $current_table | |
| string | $filepath |
| Path to the XML data file. | |
| database_manager | $manager |
| Database manager of the target database (a. | |
| moodle_database | $mdb |
| Connection to the target database (a. | |
| xmldb_structure | $schema |
| Target database schema in XMLDB format (a. | |
| moodle_transaction | $transaction |
| Transaction object. | |
| string | $transactionmode = 'allinone' |
| How to use transactions. | |
XML format importer class from file storage.
| file_xml_database_importer::__construct | ( | $filepath, | |
| moodle_database | $mdb, | ||
$check_schema = true |
|||
| ) |
Object constructor.
| string | $filepath | - path to the XML data file. Use 'php://input' for PHP input stream. |
| moodle_database | $mdb | Connection to the target database |
| boolean | $check_schema | - whether or not to check that XML database |
|
inherited |
Callback function.
Should be called only once database per import operation, before any database changes are made. It will check the database schema if
| dbtransfer_exception | if any checking (e.g. database schema, Moodle version) fails |
| float | $version | the version of the system which generated the data |
| string | $timestamp | the timestamp of the data (in ISO 8601) format. |
| void |
|
inherited |
Callback function.
Should be called only once per table import operation, before any table changes are made. It will delete all table data.
| dbtransfer_exception | an unknown table import is attempted |
| ddl_table_missing_exception | if the table is missing |
| string | $tablename | - the name of the table that will be imported |
| string | $schemaHash | - the hash of the xmldb_table schema of the table |
| void |
|
protectedinherited |
Callback function.
Called by the XML parser for character data processing.
| resource | $parser | XML parser resource. |
| string | $data | character data to be processed |
| void |
|
inherited |
Callback function.
Should be called only once database per import operation, after all database changes are made. It will commit changes.
| void |
|
inherited |
Callback function.
Should be called only once per table import operation, after all table changes are made. It will reset table sequences if any.
| string | $tablename |
| void |
|
protectedinherited |
Creates and setups a SAX parser.
Subclasses should use this method to create the XML parser.
| resource | XML parser resource. |
| file_xml_database_importer::import_database | ( | ) |
Common import method: it opens the file storage, creates the parser, feeds the XML parser with data, releases the parser and closes the file storage.
| void |
Reimplemented from database_importer.
|
inherited |
Callback function.
Should be called only once per record import operation, only between
| dml_exception | if data insert operation failed |
| string | $tablename | - the name of the table in which data will be imported |
| object | $data | - data object (fields and values will be inserted into table) |
| void |
|
inherited |
How to use transactions during the import.
| string | $mode | 'pertable', 'allinone' or 'none'. |
|
protectedinherited |
Callback function.
Called by the XML parser for closing tags processing.
| resource | $parser | XML parser resource. |
| string | $tag | name of opening tag |
| void |
|
protectedinherited |
Callback function.
Called by the XML parser for opening tags processing.
| resource | $parser | XML parser resource. |
| string | $tag | name of opening tag |
| array | $attributes | set of opening tag XML attributes |
| void |
|
protectedinherited |
Boolean flag - whether or not to check that XML database schema matches the RDBMS database schema before importing (used by.
|
protectedinherited |
Database manager of the target database (a.
|
protectedinherited |
Connection to the target database (a.
|
protectedinherited |
Target database schema in XMLDB format (a.