Merge branch 'MDL-64012' of https://github.com/timhunt/moodle
[moodle.git] / lib / dtllib.php
blob82b89cd789013a1196328295dcab3d7c0e79a2fd
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
19 /**
20 * DTL == Database Transfer Library
22 * This library includes all the required functions used to handle
23 * transfer of data from one database to another.
25 * @package core
26 * @subpackage dtl
27 * @copyright 2008 Andrei Bautu
28 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31 defined('MOODLE_INTERNAL') || die();
33 // Require {@link ddllib.php}
34 require_once($CFG->libdir.'/ddllib.php');
35 // Require {@link database_exporter.php}
36 require_once($CFG->libdir.'/dtl/database_exporter.php');
37 // Require {@link xml_database_exporter.php}
38 require_once($CFG->libdir.'/dtl/xml_database_exporter.php');
39 // Require {@link file_xml_database_exporter.php}
40 require_once($CFG->libdir.'/dtl/file_xml_database_exporter.php');
41 // Require {@link string_xml_database_exporter.php}
42 require_once($CFG->libdir.'/dtl/string_xml_database_exporter.php');
43 // Require {@link database_mover.php}
44 require_once($CFG->libdir.'/dtl/database_mover.php');
45 // Require {@link database_importer.php}
46 require_once($CFG->libdir.'/dtl/database_importer.php');
47 // Require {@link xml_database_importer.php}
48 require_once($CFG->libdir.'/dtl/xml_database_importer.php');
49 // Require {@link file_xml_database_importer.php}
50 require_once($CFG->libdir.'/dtl/file_xml_database_importer.php');
51 // Require {@link string_xml_database_importer.php}
52 require_once($CFG->libdir.'/dtl/string_xml_database_importer.php');
54 /**
55 * Exception class for db transfer
56 * @see moodle_exception
58 class dbtransfer_exception extends moodle_exception {
59 /**
60 * @global object
61 * @param string $errorcode
62 * @param string $a
63 * @param string $link
64 * @param string $debuginfo
66 function __construct($errorcode, $a=null, $link='', $debuginfo=null) {
67 global $CFG;
68 if (empty($link)) {
69 $link = "$CFG->wwwroot/$CFG->admin/";
71 parent::__construct($errorcode, 'core_dbtransfer', $link, $a, $debuginfo);