diff --git a/ChangeLog b/ChangeLog
index ec5d8059bc..304fb89353 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/export.php b/export.php
index 5e9765990b..50ceb500ac 100644
--- a/export.php
+++ b/export.php
@@ -52,6 +52,7 @@ if (!defined('TESTSUITE')) {
'limit_to',
'limit_from',
'allrows',
+ 'lock_tables',
'output_format',
'filename_template',
'maxsize',
@@ -411,11 +412,26 @@ if (!defined('TESTSUITE')) {
$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 (!defined('TESTSUITE')) {
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;
diff --git a/import.php b/import.php
index 035e076dc0..f5dbd6af09 100644
--- a/import.php
+++ b/import.php
@@ -596,7 +596,29 @@ if (! $error) {
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);
+ }
}
}
diff --git a/libraries/config.default.php b/libraries/config.default.php
index 672bcbe9be..b0b059e08f 100644
--- a/libraries/config.default.php
+++ b/libraries/config.default.php
@@ -1344,6 +1344,13 @@ $cfg['Export']['method'] = 'quick';
*/
$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']['allow_interrupt'] = true;
*/
$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;
+
/**
*
*
diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php
index f78c4c76a4..4b04dc5bc4 100644
--- a/libraries/config/messages.inc.php
+++ b/libraries/config/messages.inc.php
@@ -107,6 +107,9 @@ $strConfigExecTimeLimit_desc = __(
. 'limit).'
);
$strConfigExecTimeLimit_name = __('Maximum execution time');
+$strConfigExport_lock_tables_name = sprintf(
+ __('Use %s statement'), 'LOCK TABLES'
+);
$strConfigExport_asfile_name = __('Save as file');
$strConfigExport_charset_name = __('Character set of the file');
$strConfigExport_codegen_format_name = __('Format');
@@ -329,6 +332,10 @@ $strConfigImport_allow_interrupt_desc = __(
. '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');
diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php
index dba8b6f2af..34b1180d38 100644
--- a/libraries/config/setup.forms.php
+++ b/libraries/config/setup.forms.php
@@ -244,7 +244,8 @@ $forms['Import']['Import_defaults'] = array('Import' => array(
'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 @@ $forms['Export']['Export_defaults'] = array('Export' => array(
'format',
'compression',
'charset',
+ 'lock_tables',
'asfile' => ':group',
'onserver',
'onserver_overwrite',
diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php
index 442bb35a15..f6b63a92fb 100644
--- a/libraries/config/user_preferences.forms.php
+++ b/libraries/config/user_preferences.forms.php
@@ -143,7 +143,9 @@ $forms['Import']['Import_defaults'] = array(
'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 @@ $forms['Export']['Export_defaults'] = array(
'Export/format',
'Export/compression',
'Export/charset',
+ 'Export/lock_tables',
'Export/asfile' => ':group',
'Export/onserver',
'Export/onserver_overwrite',
diff --git a/libraries/display_export.lib.php b/libraries/display_export.lib.php
index d7f5ed828b..92f79df31c 100644
--- a/libraries/display_export.lib.php
+++ b/libraries/display_export.lib.php
@@ -652,6 +652,17 @@ function PMA_getHtmlForExportOptionsOutput($export_type)
$html .= '';
+
+ if ($export_type != 'server') {
+ $html .= '