Skip to content

Commit

Permalink
Fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Delisle committed Nov 9, 2013
1 parent 4299a0f commit 971aec3
Showing 1 changed file with 44 additions and 30 deletions.
74 changes: 44 additions & 30 deletions export.php
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ function PMA_exportOutputHandler($line)
// Include dates in export?
$do_dates = isset($GLOBALS[$what . '_dates']);

$whatStrucOrData = $GLOBALS[$what . '_structure_or_data'];

/**
* Builds the dump
*/
Expand All @@ -657,7 +659,7 @@ function PMA_exportOutputHandler($line)
break 2;
}
if (method_exists($export_plugin, 'exportRoutines')
&& strpos($GLOBALS['sql_structure_or_data'], 'structure') !== false
&& strpos($whatStrucOrData, 'structure') !== false
&& isset($GLOBALS['sql_procedure_function'])
) {
$export_plugin->exportRoutines($current_db);
Expand All @@ -672,8 +674,8 @@ function PMA_exportOutputHandler($line)
if ($is_view) {
$views[] = $table;
}
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
Expand All @@ -686,20 +688,23 @@ function PMA_exportOutputHandler($line)
}
}
// if this is a view or a merge table, don't export data
if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_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)
$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)) {
if (! $export_plugin->exportData(
$current_db, $table, $crlf, $err_url, $local_query
)) {
break 3;
}
}
// now export the triggers (needs to be done after the data
// because triggers can modify already imported tables)
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$current_db, $table, $crlf, $err_url,
Expand All @@ -712,8 +717,8 @@ function PMA_exportOutputHandler($line)
}
foreach ($views as $view) {
// no data export for a view
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$current_db, $view, $crlf, $err_url,
Expand Down Expand Up @@ -746,16 +751,17 @@ function PMA_exportOutputHandler($line)

$i = 0;
$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
// if this is a view, collect it for later;
// views must be exported after the tables
$is_view = PMA_Table::isView($db, $table);
if ($is_view) {
$views[] = $table;
}
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
// for a view, export a stand-in definition of the table
// to resolve view dependencies
Expand All @@ -768,20 +774,22 @@ function PMA_exportOutputHandler($line)
}
}
// if this is a view or a merge table, don't export data
if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data')
if (($whatStrucOrData == 'data'
|| $whatStrucOrData == 'structure_and_data')
&& ! ($is_view || PMA_Table::isMerge($db, $table))
) {
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($db)
. '.' . PMA_Util::backquote($table);
if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) {
if (! $export_plugin->exportData(
$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 ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
Expand All @@ -794,8 +802,8 @@ function PMA_exportOutputHandler($line)
}
foreach ($views as $view) {
// no data export for a view
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $view, $crlf, $err_url,
Expand All @@ -816,7 +824,11 @@ function PMA_exportOutputHandler($line)
}
// We export just one table
// $allrows comes from the form when "Dump all rows" has been selected
if (isset($allrows) && $allrows == '0' && $limit_to > 0 && $limit_from >= 0) {
if (isset($allrows)
&& $allrows == '0'
&& $limit_to > 0
&& $limit_from >= 0
) {
$add_query = ' LIMIT '
. (($limit_from > 0) ? $limit_from . ', ' : '')
. $limit_to;
Expand All @@ -825,8 +837,8 @@ function PMA_exportOutputHandler($line)
}

$is_view = PMA_Table::isView($db, $table);
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
Expand All @@ -839,8 +851,8 @@ function PMA_exportOutputHandler($line)
// If this is an export of a single view, we have to export data;
// for example, a PDF report
// if it is a merge table, no data is exported
if (($GLOBALS[$what . '_structure_or_data'] == 'data'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data')
if (($whatStrucOrData == 'data'
|| $whatStrucOrData == 'structure_and_data')
&& ! PMA_Table::isMerge($db, $table)
) {
if (! empty($sql_query)) {
Expand All @@ -855,14 +867,16 @@ function PMA_exportOutputHandler($line)
$local_query = 'SELECT * FROM ' . PMA_Util::backquote($db)
. '.' . PMA_Util::backquote($table) . $add_query;
}
if (! $export_plugin->exportData($db, $table, $crlf, $err_url, $local_query)) {
if (! $export_plugin->exportData(
$db, $table, $crlf, $err_url, $local_query
)) {
break;
}
}
// now export the triggers (needs to be done after the data because
// triggers can modify already imported tables)
if ($GLOBALS[$what . '_structure_or_data'] == 'structure'
|| $GLOBALS[$what . '_structure_or_data'] == 'structure_and_data'
if ($whatStrucOrData == 'structure'
|| $whatStrucOrData == 'structure_and_data'
) {
if (! $export_plugin->exportStructure(
$db, $table, $crlf, $err_url,
Expand Down

0 comments on commit 971aec3

Please sign in to comment.