Permalink
Browse files

Merge remote-tracking branch 'origin/master'

  • Loading branch information...
weblate committed Mar 11, 2015
2 parents f273de2 + a093119 commit 8b277fc7858ca1eed87b3f41c50689be15cd4ba5
View
@@ -5,6 +5,7 @@ phpMyAdmin - ChangeLog
+ rfe Pagination for GIS visualization
+ rfe #1570 Usability improvements for console
+ rfe #1614 Access to Add columns text-box and Go button when creating table
+ rfe #1306 Add lock tables, disable keys options
4.4.0.0 (not yet released)
+ rfe #1553 InnoDB presently supports one FULLTEXT index creation at a time
View
@@ -52,6 +52,7 @@
'limit_to',
'limit_from',
'allrows',
'lock_tables',
'output_format',
'filename_template',
'maxsize',
@@ -411,11 +412,26 @@
$aliases
);
} elseif ($export_type == 'database') {
PMA_exportDatabase(
$db, $tables, $whatStrucOrData, $export_plugin, $crlf, $err_url,
$export_type, $do_relation, $do_comments, $do_mime, $do_dates,
$aliases
);
if (isset($lock_tables)) {
PMA_lockTables($db, $tables, "READ");
try {
PMA_exportDatabase(
$db, $tables, $whatStrucOrData, $export_plugin, $crlf,
$err_url, $export_type, $do_relation, $do_comments,
$do_mime, $do_dates, $aliases
);
PMA_unlockTables();
} catch (Exception $e) { // TODO use finally when PHP version is 5.5
PMA_unlockTables();
throw $e;
}
} else {
PMA_exportDatabase(
$db, $tables, $whatStrucOrData, $export_plugin, $crlf, $err_url,
$export_type, $do_relation, $do_comments, $do_mime, $do_dates,
$aliases
);
}
} else {
// We export just one table
// $allrows comes from the form when "Dump all rows" has been selected
@@ -428,11 +444,27 @@
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, $aliases
);
if (isset($lock_tables)) {
try {
PMA_lockTables($db, array($table), "READ");
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, $aliases
);
PMA_unlockTables();
} catch (Exception $e) { // TODO use finally when PHP version is 5.5
PMA_unlockTables();
throw $e;
}
} else {
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, $aliases
);
}
}
if (! $export_plugin->exportFooter()) {
break;
View
@@ -596,7 +596,29 @@
PMA_stopImport($message);
} else {
// Do the real import
$import_plugin->doImport($sql_data);
if (isset($_REQUEST['disable_foreign_keys'])) {
$default_fk_check_value = $GLOBALS['dbi']->fetchValue(
"SHOW VARIABLES LIKE 'foreign_key_checks';", 0, 1
) == 'ON';
try {
if ($default_fk_check_value) {
$GLOBALS['dbi']->tryQuery("SET FOREIGN_KEY_CHECKS = 0;");
}
$import_plugin->doImport($sql_data);
if ($default_fk_check_value) {
$GLOBALS['dbi']->tryQuery('SET FOREIGN_KEY_CHECKS = 1;');
}
} catch (Exception $e) {
if ($default_fk_check_value) {
$GLOBALS['dbi']->tryQuery('SET FOREIGN_KEY_CHECKS = 1;');
}
throw $e;
}
} else {
$import_plugin->doImport($sql_data);
}
}
}
@@ -1344,6 +1344,13 @@
*/
$cfg['Export']['compression'] = 'none';
/**
* Whether to LOCK TABLES before exporting
*
* @global boolean $cfg['Export']['lock_tables']
*/
$cfg['Export']['lock_tables'] = false;
/**
*
*
@@ -2114,6 +2121,13 @@
*/
$cfg['Import']['skip_queries'] = 0;
/**
* Whether to disable foreign key checks while importing
*
* @global boolean $cfg['Import']['disable_foreign_keys']
*/
$cfg['Import']['disable_foreign_keys'] = false;
/**
*
*
@@ -107,6 +107,9 @@
. 'limit).'
);
$strConfigExecTimeLimit_name = __('Maximum execution time');
$strConfigExport_lock_tables_name = sprintf(
__('Use %s statement'), '<code>LOCK TABLES</code>'
);
$strConfigExport_asfile_name = __('Save as file');
$strConfigExport_charset_name = __('Character set of the file');
$strConfigExport_codegen_format_name = __('Format');
@@ -329,6 +332,10 @@
. 'transactions.'
);
$strConfigImport_allow_interrupt_name = __('Partial import: allow interrupt');
$strConfigImport_disable_foreign_keys_desc = __(
'Temporarily disable foreign key checks while importing'
);
$strConfigImport_disable_foreign_keys_name = __('Disable foreign key checks');
$strConfigImport_charset_name = __('Character set of the file');
$strConfigImport_csv_col_names_name = __('Lines terminated with');
$strConfigImport_csv_enclosed_name = __('Columns enclosed with');
@@ -244,7 +244,8 @@
'format',
'charset',
'allow_interrupt',
'skip_queries'));
'skip_queries',
'disable_foreign_keys'));
$forms['Import']['Sql'] = array('Import' => array(
'sql_compatibility',
'sql_no_auto_value_on_zero'));
@@ -281,6 +282,7 @@
'format',
'compression',
'charset',
'lock_tables',
'asfile' => ':group',
'onserver',
'onserver_overwrite',
@@ -143,7 +143,9 @@
'Import/format',
'Import/charset',
'Import/allow_interrupt',
'Import/skip_queries');
'Import/skip_queries',
'Import/disable_foreign_keys'
);
$forms['Import']['Sql'] = array(
'Import/sql_compatibility',
'Import/sql_no_auto_value_on_zero',
@@ -180,6 +182,7 @@
'Export/format',
'Export/compression',
'Export/charset',
'Export/lock_tables',
'Export/asfile' => ':group',
'Export/onserver',
'Export/onserver_overwrite',
@@ -652,6 +652,17 @@ function PMA_getHtmlForExportOptionsOutput($export_type)
$html .= '<label for="btn_alias_config">';
$html .= __('Rename exported databases/tables/columns');
$html .= '</label></li>';
if ($export_type != 'server') {
$html .= '<li>';
$html .= '<input type="checkbox" name="lock_tables"';
$html .= ' value="something" id="checkbox_lock_tables"';
$html .= ' ' . PMA_exportCheckboxCheck('lock_tables') . '/>';
$html .= '<label for="checkbox_lock_tables">';
$html .= sprintf(__('Use %s statement'), '<code>LOCK TABLES</code>');
$html .= '</label></li>';
}
$html .= '<li>';
$html .= '<input type="radio" name="output_format" value="sendit" ';
$html .= 'id="radio_dump_asfile" ';
@@ -321,6 +321,28 @@ function PMA_getHtmlForImportOptionsPartialImport($timeout_passed, $offset)
return $html;
}
/**
* Prints Html For Display Import options : Other
*
* @return string
*/
function PMA_getHtmlForImportOptionsOther()
{
$html = ' <div class="importoptions">';
$html .= ' <h3>' . __('Other Options:') . '</h3>';
$html .= ' <div class="formelementrow">';
$html .= ' <input type="checkbox" name="disable_foreign_keys"';
$html .= ' value="yes" id="checkbox_disable_foreign_keys" ';
$html .= PMA_pluginCheckboxCheck('Import', 'disable_foreign_keys') . '/>';
$html .= ' <label for="checkbox_disable_foreign_keys">';
$html .= __('Disable foreign key check');
$html .= ' </label>';
$html .= ' </div>';
$html .= ' </div>';
return $html;
}
/**
* Prints Html For Display Import options : Format
*
@@ -421,6 +443,8 @@ function PMA_getHtmlForImport(
$html .= PMA_getHtmlForImportOptionsPartialImport($timeout_passed, $offset);
$html .= PMA_getHtmlForImportOptionsOther();
$html .= PMA_getHtmlForImportOptionsFormat($import_list);
$html .= PMA_getHtmlForImportOptionsSubmit();
View
@@ -855,4 +855,35 @@ function PMA_mergeAliases($aliases1, $aliases2)
}
return $aliases;
}
/**
* Locks tables
*
* @param string $db database name
* @param array $tables list of table names
* @param string $lockType lock type; "[LOW_PRIORITY] WRITE" or "READ [LOCAL]"
*
* @return mixed result of the query
*/
function PMA_lockTables($db, $tables, $lockType = "WRITE")
{
$locks = array();
foreach($tables as $table) {
$locks[] = PMA_Util::backquote($db) . "." . PMA_Util::backquote($table)
. " " . $lockType;
}
$sql = "LOCK TABLES " . implode(", ", $locks);
return $GLOBALS['dbi']->tryQuery($sql);
}
/**
* Releases table locks
*
* @return mixed result of the query
*/
function PMA_unlockTables()
{
return $GLOBALS['dbi']->tryQuery("UNLOCK TABLES");
}
?>

0 comments on commit 8b277fc

Please sign in to comment.