Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
47e44e519d
@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog
|
||||
======================
|
||||
|
||||
4.2.0.0 (not yet released)
|
||||
+ rfe #1483 Export Server/Database/Table without triggers
|
||||
+ rfe #1662 Add table comment tool tip in database structure page
|
||||
+ rfe #1447 Single table for display Character Sets and Collations
|
||||
+ rfe #1455 Display icons/text/both for the table row actions
|
||||
|
||||
@ -107,6 +107,7 @@ if (!defined('TESTSUITE')) {
|
||||
'sql_drop_table',
|
||||
'sql_procedure_function',
|
||||
'sql_create_table_statements',
|
||||
'sql_create_trigger',
|
||||
'sql_if_not_exists',
|
||||
'sql_auto_increment',
|
||||
'sql_backquotes',
|
||||
|
||||
@ -1820,6 +1820,13 @@ $cfg['Export']['sql_if_not_exists'] = true;
|
||||
*/
|
||||
$cfg['Export']['sql_procedure_function'] = true;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @global boolean $cfg['Export']['sql_create_trigger']
|
||||
*/
|
||||
$cfg['Export']['sql_create_trigger'] = true;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
|
||||
@ -170,7 +170,9 @@ $strConfigExport_sql_disable_fk_name = __('Disable foreign key checks');
|
||||
$strConfigExport_sql_views_as_tables_name = __('Export views as tables');
|
||||
$strConfigExport_sql_drop_database_name = sprintf(__('Add %s'), 'DROP DATABASE');
|
||||
$strConfigExport_sql_drop_table_name
|
||||
= sprintf(__('Add %s'), 'DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT');
|
||||
= sprintf(__('Add %s'), 'DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER');
|
||||
$strConfigExport_sql_create_trigger_name
|
||||
= sprintf(__('Add %s'), 'CREATE TRIGGER');
|
||||
$strConfigExport_sql_hex_for_blob_name = __('Use hexadecimal for BLOB');
|
||||
$strConfigExport_sql_if_not_exists_name = sprintf(__('Add %s'), 'IF NOT EXISTS');
|
||||
$strConfigExport_sql_ignore_name = __('Use ignore inserts');
|
||||
|
||||
@ -301,6 +301,7 @@ $forms['Export']['Sql'] = array('Export' => array(
|
||||
':group:' . __('Structure'),
|
||||
'sql_drop_table',
|
||||
'sql_procedure_function',
|
||||
'sql_create_trigger',
|
||||
'sql_create_table_statements' => ':group',
|
||||
'sql_if_not_exists',
|
||||
'sql_auto_increment',
|
||||
|
||||
@ -200,6 +200,7 @@ $forms['Export']['Sql'] = array(
|
||||
':group:' . __('Structure'),
|
||||
'Export/sql_drop_table',
|
||||
'Export/sql_procedure_function',
|
||||
'Export/sql_create_trigger',
|
||||
'Export/sql_create_table_statements' => ':group',
|
||||
'Export/sql_if_not_exists',
|
||||
'Export/sql_auto_increment',
|
||||
|
||||
@ -555,8 +555,8 @@ function PMA_exportDatabase(
|
||||
}
|
||||
// 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 (isset($GLOBALS['sql_create_trigger']) && ($whatStrucOrData == 'structure'
|
||||
|| $whatStrucOrData == 'structure_and_data')
|
||||
) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
@ -667,8 +667,8 @@ function PMA_exportTable(
|
||||
}
|
||||
// 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 (isset($GLOBALS['sql_create_trigger']) && ($whatStrucOrData == 'structure'
|
||||
|| $whatStrucOrData == 'structure_and_data')
|
||||
) {
|
||||
if (! $export_plugin->exportStructure(
|
||||
$db, $table, $crlf, $err_url,
|
||||
|
||||
@ -252,6 +252,9 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$drop_clause .= '<code> / TRIGGER</code>';
|
||||
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('drop_table');
|
||||
$leaf->setText(sprintf(__('Add %s statement'), $drop_clause));
|
||||
@ -270,6 +273,14 @@ class ExportSql extends ExportPlugin
|
||||
);
|
||||
$subgroup->addProperty($leaf);
|
||||
}
|
||||
|
||||
// Add triggers option
|
||||
$leaf = new BoolPropertyItem();
|
||||
$leaf->setName('create_trigger');
|
||||
$leaf->setText(
|
||||
sprintf(__('Add %s statement'), '<code>CREATE TRIGGER</code>')
|
||||
);
|
||||
$subgroup->addProperty($leaf);
|
||||
|
||||
// begin CREATE TABLE statements
|
||||
$subgroup_create_table = new OptionsPropertySubgroup();
|
||||
@ -1620,7 +1631,9 @@ class ExportSql extends ExportPlugin
|
||||
. $this->_exportComment();
|
||||
$delimiter = '//';
|
||||
foreach ($triggers as $trigger) {
|
||||
$dump .= $trigger['drop'] . ';' . $crlf;
|
||||
if (! empty($GLOBALS['sql_drop_table'])) {
|
||||
$dump .= $trigger['drop'] . ';' . $crlf;
|
||||
}
|
||||
$dump .= 'DELIMITER ' . $delimiter . $crlf;
|
||||
$dump .= $trigger['create'];
|
||||
$dump .= 'DELIMITER ;' . $crlf;
|
||||
|
||||
@ -262,9 +262,15 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
'Add <code>DROP TABLE / VIEW / PROCEDURE / FUNCTION</code>' .
|
||||
'<code> / EVENT</code> statement',
|
||||
'<code> / EVENT</code><code> / TRIGGER</code> statement',
|
||||
$leaf->getText()
|
||||
);
|
||||
|
||||
$leaf = array_shift($leaves);
|
||||
$this->assertInstanceOf(
|
||||
'BoolPropertyItem',
|
||||
$leaf
|
||||
);
|
||||
|
||||
$leaf = array_shift($leaves);
|
||||
$this->assertInstanceOf(
|
||||
@ -399,7 +405,7 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
$properties = $properties[0]->getProperties();
|
||||
|
||||
$this->assertCount(
|
||||
3,
|
||||
4,
|
||||
$properties
|
||||
);
|
||||
|
||||
@ -1647,6 +1653,9 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
unset($GLOBALS['sql_compatibility']);
|
||||
unset($GLOBALS['sql_backquotes']);
|
||||
|
||||
$GLOBALS['sql_create_trigger'] = true;
|
||||
$GLOBALS['sql_drop_table'] = true;
|
||||
|
||||
ob_start();
|
||||
$this->assertTrue(
|
||||
$this->object->exportStructure(
|
||||
@ -1664,6 +1673,9 @@ class PMA_ExportSql_Test extends PHPUnit_Framework_TestCase
|
||||
"foo;\nDELIMITER //\nbarDELIMITER ;\n",
|
||||
$result
|
||||
);
|
||||
|
||||
unset($GLOBALS['sql_create_trigger']);
|
||||
unset($GLOBALS['sql_drop_table']);
|
||||
|
||||
// case 3
|
||||
$GLOBALS['sql_views_as_tables'] = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user