Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
XML format importer class (uses SAX for speed and low memory footprint). More...
Public Member Functions | |
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. | |
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 | |
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 (uses SAX for speed and low memory footprint).
Provides logic for parsing XML data and calling appropriate callbacks. Subclasses should define XML data sources.
|
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 |
|
protected |
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 |
|
protected |
Creates and setups a SAX parser.
Subclasses should use this method to create the XML parser.
resource | XML parser resource. |
|
inherited |
Common import method.
void |
Reimplemented in file_xml_database_importer, and string_xml_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'. |
|
protected |
Callback function.
Called by the XML parser for closing tags processing.
resource | $parser | XML parser resource. |
string | $tag | name of opening tag |
void |
|
protected |
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.