require_once 'include/db_backup/DatabaseBackup.php'; $mode = $_REQUEST['mode']; $source_directory = $_SESSION['migration_info']['source_directory']; require_once $source_directory . 'config.inc.php'; $createDB = $_REQUEST['createDB']; if (empty($createDB)) { $createDB = false; } else { $createDB = true; } $backup = new DatabaseBackup($dbconfig['db_type'], $createDB); $hostName = $dbconfig['db_server'] . $dbconfig['db_port']; $username = $dbconfig['db_username']; $password = $dbconfig['db_password']; $dbName = $dbconfig['db_name']; $backup->setSourceConfig(new DatabaseConfig($hostName, $username, $password, $dbName)); if (strtolower($mode) == 'dump') { header('Content-type: text/plain; charset=UTF-8'); $backup->enableDownloadMode(); $backup->backup(); } else { $targetName = $_REQUEST['newDatabaseName']; try { if (!empty($targetName) && $dbName != $targetName) { $rootUserName = $_SESSION['migration_info']['root_username']; $rootPassword = $_SESSION['migration_info']['root_password']; $backup->setDestinationConfig(new DatabaseConfig($hostName, $username, $password, $targetName, $rootUserName, $rootPassword)); $backup->backup(); $_SESSION['migration_info']['new_dbname'] = $targetName; if ($createDB && $backup->isUTF8SupportEnabled()) { $_SESSION['migration_info']['db_utf8_support'] = true;