Example #1
0
/**
 * Export at the server level
 *
 * @param string       $db_select       the selected databases to export
 * @param string       $whatStrucOrData structure or data or both
 * @param ExportPlugin $export_plugin   the selected export plugin
 * @param string       $crlf            end of line character(s)
 * @param string       $err_url         the URL in case of error
 * @param string       $export_type     the export type
 * @param bool         $do_relation     whether to export relation info
 * @param bool         $do_comments     whether to add comments
 * @param bool         $do_mime         whether to add MIME info
 * @param bool         $do_dates        whether to add dates
 * @param array        $aliases         alias information for db/table/column
 * @param string       $separate_files  whether it is a separate-files export
 *
 * @return void
 */
function PMA_exportServer($db_select, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases, $separate_files)
{
    if (!empty($db_select)) {
        $tmp_select = implode($db_select, '|');
        $tmp_select = '|' . $tmp_select . '|';
    }
    // Walk over databases
    foreach ($GLOBALS['pma']->databases as $current_db) {
        if (isset($tmp_select) && mb_strpos(' ' . $tmp_select, '|' . $current_db . '|')) {
            $tables = $GLOBALS['dbi']->getTables($current_db);
            PMA_exportDatabase($current_db, $tables, $whatStrucOrData, $tables, $tables, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases, $separate_files == 'database' ? $separate_files : '');
            if ($separate_files == 'server') {
                PMA_saveObjectInBuffer($current_db);
            }
        }
    }
    // end foreach database
}
Example #2
0
     if (!empty($_REQUEST['structure_or_data_forced'])) {
         $table_structure = $tables;
         $table_data = $tables;
     }
     if (isset($lock_tables)) {
         PMA_lockTables($db, $tables, "READ");
         try {
             PMA_exportDatabase($db, $tables, $whatStrucOrData, $table_structure, $table_data, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases, $separate_files);
             PMA_unlockTables();
         } catch (Exception $e) {
             // TODO use finally when PHP version is 5.5
             PMA_unlockTables();
             throw $e;
         }
     } else {
         PMA_exportDatabase($db, $tables, $whatStrucOrData, $table_structure, $table_data, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases, $separate_files);
     }
 } else {
     // We export just one table
     // $allrows comes from the form when "Dump all rows" has been selected
     if (!isset($allrows)) {
         $allrows = '';
     }
     if (!isset($limit_to)) {
         $limit_to = 0;
     }
     if (!isset($limit_from)) {
         $limit_from = 0;
     }
     if (isset($lock_tables)) {
         try {
Example #3
0
 if ($do_mime) {
     include_once 'libraries/transformations.lib.php';
 }
 // Include dates in export?
 $do_dates = isset($GLOBALS[$what . '_dates']);
 $whatStrucOrData = $GLOBALS[$what . '_structure_or_data'];
 /**
  * Builds the dump
  */
 if ($export_type == 'server') {
     if (!isset($db_select)) {
         $db_select = '';
     }
     PMA_exportServer($db_select, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates);
 } elseif ($export_type == 'database') {
     PMA_exportDatabase($db, $tables, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates);
 } else {
     // We export just one table
     // $allrows comes from the form when "Dump all rows" has been selected
     if (!isset($allrows)) {
         $allrows = '';
     }
     if (!isset($limit_to)) {
         $limit_to = 0;
     }
     if (!isset($limit_from)) {
         $limit_from = 0;
     }
     PMA_exportTable($db, $table, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $allrows, $limit_to, $limit_from, $sql_query);
 }
 if (!$export_plugin->exportFooter()) {
/**
 * Export at the server level
 *
 * @param string $db_select       the selected databases to export
 * @param string $whatStrucOrData structure or data or both
 * @param object $export_plugin   the selected export plugin
 * @param string $crlf            end of line character(s)
 * @param string $err_url         the URL in case of error
 * @param string $export_type     the export type
 * @param bool   $do_relation     whether to export relation info
 * @param bool   $do_comments     whether to add comments
 * @param bool   $do_mime         whether to add MIME info
 * @param bool   $do_dates        whether to add dates
 * @param array  $aliases         Alias information for db/table/column
 *
 * @return void
 */
function PMA_exportServer($db_select, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases)
{
    /** @var PMA_String $pmaStr */
    $pmaStr = $GLOBALS['PMA_String'];
    if (!empty($db_select)) {
        $tmp_select = implode($db_select, '|');
        $tmp_select = '|' . $tmp_select . '|';
    }
    // Walk over databases
    foreach ($GLOBALS['pma']->databases as $current_db) {
        if (isset($tmp_select) && $pmaStr->strpos(' ' . $tmp_select, '|' . $current_db . '|')) {
            $tables = $GLOBALS['dbi']->getTables($current_db);
            PMA_exportDatabase($current_db, $tables, $whatStrucOrData, $export_plugin, $crlf, $err_url, $export_type, $do_relation, $do_comments, $do_mime, $do_dates, $aliases);
        }
    }
    // end foreach database
}