Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
file_xml_database_exporter Class Reference

XML format exporter class to file storage. More...

Inheritance diagram for file_xml_database_exporter:
xml_database_exporter database_exporter

Public Member Functions

 __construct ($filepath, moodle_database $mdb, $check_schema=true)
 Object constructor. More...
 
 begin_database_export ($version, $release, $timestamp, $description)
 Callback function. More...
 
 begin_table_export (xmldb_table $table)
 Callback function. More...
 
 export_database ($description=null)
 Specific implementation for file exporting the database: it opens output stream, calls superclass. More...
 
 export_table_data (xmldb_table $table, $data)
 Callback function. More...
 
 finish_database_export ()
 Callback function. More...
 
 finish_table_export (xmldb_table $table)
 Callback function. More...
 

Protected Member Functions

 output ($text)
 Specific output method for the file XML sink. More...
 

Protected Attributes

bool $check_schema
 Boolean flag - whether or not to check that XML database schema matches the RDBMS database schema before exporting (used by. More...
 
resource $file
 File descriptor for the output file.
 
string $filepath
 Path to the XML data file.
 
database_manager $manager
 Database manager of the source database (a. More...
 
moodle_database $mdb
 Connection to the source database (a. More...
 
xmldb_structure $schema
 Source database schema in XMLDB format (a. More...
 

Detailed Description

XML format exporter class to file storage.

Constructor & Destructor Documentation

◆ __construct()

file_xml_database_exporter::__construct (   $filepath,
moodle_database  $mdb,
  $check_schema = true 
)

Object constructor.

Parameters
string$filepath- path to the XML data file. Use 'php://output' for PHP output stream.
moodle_database$mdbConnection to the source database
See also
xml_database_exporter::__construct()
Parameters
boolean$check_schema- whether or not to check that XML database
See also
xml_database_exporter::__construct()

Member Function Documentation

◆ begin_database_export()

xml_database_exporter::begin_database_export (   $version,
  $release,
  $timestamp,
  $description 
)
inherited

Callback function.

Outputs open XML PI and moodle_database opening tag.

Parameters
float$versionthe version of the system which generating the data
string$releasemoodle release info
string$timestampthe timestamp of the data (in ISO 8601) format.
string$descriptiona user description of the data.
Return values
void

Reimplemented from database_exporter.

◆ begin_table_export()

xml_database_exporter::begin_table_export ( xmldb_table  $table)
inherited

Callback function.

Outputs table opening tag.

Parameters
xmldb_table$table- XMLDB object for the exported table
Return values
void

Reimplemented from database_exporter.

◆ export_database()

file_xml_database_exporter::export_database (   $description = null)

Specific implementation for file exporting the database: it opens output stream, calls superclass.

See also
database_exporter::export_database() and closes output stream.
Exceptions
dbtransfer_exceptionif any checking (e.g. database schema) fails
Parameters
string$descriptiona user description of the data.

Reimplemented from database_exporter.

◆ export_table_data()

xml_database_exporter::export_table_data ( xmldb_table  $table,
  $data 
)
inherited

Callback function.

Outputs record tag with field subtags and data.

Parameters
xmldb_table$table- XMLDB object of the table from which data was retrieved
object$data- data object (fields and values from record)
Return values
void

Reimplemented from database_exporter.

◆ finish_database_export()

xml_database_exporter::finish_database_export ( )
inherited

Callback function.

Outputs moodle_database closing tag.

Reimplemented from database_exporter.

◆ finish_table_export()

xml_database_exporter::finish_table_export ( xmldb_table  $table)
inherited

Callback function.

Outputs table closing tag.

Parameters
xmldb_table$table- XMLDB object for the exported table

Reimplemented from database_exporter.

◆ output()

file_xml_database_exporter::output (   $text)
protected

Specific output method for the file XML sink.

Parameters
string$text

Reimplemented from xml_database_exporter.

Member Data Documentation

◆ $check_schema

bool database_exporter::$check_schema
protectedinherited

Boolean flag - whether or not to check that XML database schema matches the RDBMS database schema before exporting (used by.

See also
export_database).

◆ $manager

database_manager database_exporter::$manager
protectedinherited

Database manager of the source database (a.

See also
database_manager object).

◆ $mdb

moodle_database database_exporter::$mdb
protectedinherited

Connection to the source database (a.

See also
moodle_database object).

◆ $schema

xmldb_structure database_exporter::$schema
protectedinherited

Source database schema in XMLDB format (a.

See also
xmldb_structure object).

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