$baseUrl .= isset($_SERVER['SCRIPT_NAME']) ? dirname(dirname($_SERVER['SCRIPT_NAME'])) : dirname(dirname(getenv('SCRIPT_NAME'))); require_once DP_BASE_DIR . '/install/install.inc.php'; $AppUI = new InstallerUI(); // Fake AppUI class to appease the db_connect utilities. $dbMsg = ''; $cFileMsg = 'Not Created'; $dbErr = false; $cFileErr = false; $dbtype = trim(dPInstallGetParam($_POST, 'dbtype', 'mysql')); $dbhost = trim(dPInstallGetParam($_POST, 'dbhost', '')); $dbname = trim(dPInstallGetParam($_POST, 'dbname', '')); $dbuser = trim(dPInstallGetParam($_POST, 'dbuser', '')); $dbpass = trim(dPInstallGetParam($_POST, 'dbpass', '')); $dbdrop = dPInstallGetParam($_POST, 'dbdrop', false); $mode = dPInstallGetParam($_POST, 'mode', 'upgrade'); $dbpersist = dPInstallGetParam($_POST, 'dbpersist', false); $dobackup = isset($_POST['dobackup']); $do_db = isset($_POST['do_db']); $do_db_cfg = isset($_POST['do_db_cfg']); $do_cfg = isset($_POST['do_cfg']); // Create a dPconfig array for dependent code $dPconfig = array('dbtype' => $dbtype, 'dbhost' => $dbhost, 'dbname' => $dbname, 'dbpass' => $dbpass, 'dbuser' => $dbuser, 'dbpersist' => $dbpersist, 'root_dir' => $baseDir, 'base_url' => $baseUrl); // Version array for moving from version to version. $versionPath = array('1.0.2', '2.0-alpha', '2.0-beta', '2.0', '2.0.1', '2.0.2', '2.0.3', '2.0.4', '2.1-rc1', '2.1-rc2', '2.1', '2.1.1', '2.1.2', '2.1.3'); global $lastDBUpdate; $lastDBUpdate = ''; require_once DP_BASE_DIR . '/lib/adodb/adodb.inc.php'; @(include_once DP_BASE_DIR . '/includes/version.php'); $db = NewADOConnection($dbtype); if (!empty($db)) { $dbc = $db->Connect($dbhost, $dbuser, $dbpass);
<?php $baseDir = dirname(dirname(__FILE__)); require_once "{$baseDir}/install/install.inc.php"; require_once "{$baseDir}/lib/adodb/adodb.inc.php"; $AppUI =& new InstallerUI(); // Fake AppUI class to appease the db_connect utilities. $dbtype = trim(dPInstallGetParam($_POST, 'dbtype', 'mysql')); $dbhost = trim(dPInstallGetParam($_POST, 'dbhost', '')); $dbname = trim(dPInstallGetParam($_POST, 'dbname', '')); $dbuser = trim(dPInstallGetParam($_POST, 'dbuser', '')); $dbpass = trim(dPInstallGetParam($_POST, 'dbpass', '')); $db = NewADOConnection($dbtype); if (!empty($db)) { $dbc = $db->Connect($dbhost, $dbuser, $dbpass); if ($dbc) { $existing_db = $db->SelectDB($dbname); } } else { $dbc = false; } if ($dbc) { require_once "{$baseDir}/lib/adodb/adodb-xmlschema.inc.php"; $schema = new adoSchema($db); $sql = $schema->ExtractSchema(true); header('Content-Disposition: attachment; filename="sdp.dbBackup.' . date("Ymd") . date("His") . '.xml"'); header('Content-Type: text/xml'); echo $sql; exit; } ?>