diff --git a/libraries/export.lib.php b/libraries/export.lib.php index ccd2ae454f..ae7dc265ec 100644 --- a/libraries/export.lib.php +++ b/libraries/export.lib.php @@ -475,86 +475,12 @@ function PMA_exportServer( if (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|') ) { - if (! $export_plugin->exportDBHeader($current_db)) { - break 1; - } - if (! $export_plugin->exportDBCreate($current_db)) { - break 1; - } - if (method_exists($export_plugin, 'exportRoutines') - && strpos($whatStrucOrData, 'structure') !== false - && isset($GLOBALS['sql_procedure_function']) - ) { - $export_plugin->exportRoutines($current_db); - } - $tables = $GLOBALS['dbi']->getTables($current_db); - $views = array(); - foreach ($tables as $table) { - // if this is a view, collect it for later; - // views must be exported after the tables - $is_view = PMA_Table::isView($current_db, $table); - if ($is_view) { - $views[] = $table; - } - if ($whatStrucOrData == 'structure' - || $whatStrucOrData == 'structure_and_data' - ) { - // for a view, export a stand-in definition of the table - // to resolve view dependencies - if (! $export_plugin->exportStructure( - $current_db, $table, $crlf, $err_url, - $is_view ? 'stand_in' : 'create_table', $export_type, - $do_relation, $do_comments, $do_mime, $do_dates - )) { - break 2; - } - } - // if this is a view or a merge table, don't export data - if (($whatStrucOrData == 'data' - || $whatStrucOrData == 'structure_and_data') - && ! ($is_view || PMA_Table::isMerge($current_db, $table)) - ) { - $local_query = 'SELECT * FROM ' - . PMA_Util::backquote($current_db) - . '.' . PMA_Util::backquote($table); - if (! $export_plugin->exportData( - $current_db, $table, $crlf, $err_url, $local_query - )) { - break 2; - } - } - // now export the triggers (needs to be done after the data - // because triggers can modify already imported tables) - if ($whatStrucOrData == 'structure' - || $whatStrucOrData == 'structure_and_data' - ) { - if (! $export_plugin->exportStructure( - $current_db, $table, $crlf, $err_url, - 'triggers', $export_type, - $do_relation, $do_comments, $do_mime, $do_dates - )) { - break 1; - } - } - } - foreach ($views as $view) { - // no data export for a view - if ($whatStrucOrData == 'structure' - || $whatStrucOrData == 'structure_and_data' - ) { - if (! $export_plugin->exportStructure( - $current_db, $view, $crlf, $err_url, - 'create_view', $export_type, - $do_relation, $do_comments, $do_mime, $do_dates - )) { - break 2; - } - } - } - if (! $export_plugin->exportDBFooter($current_db)) { - break 1; - } + PMA_exportDatabase( + $current_db, $tables, $whatStrucOrData, $export_plugin, $crlf, + $err_url, $export_type, $do_relation, $do_comments, $do_mime, + $do_dates + ); } } // end foreach database } @@ -596,7 +522,6 @@ function PMA_exportDatabase( $views = array(); - // $tables contains the choices from the user (via $table_select) foreach ($tables as $table) { // if this is a view, collect it for later; // views must be exported after the tables