bug #4745 Tracking does not handle views properly

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
Madhura Jayaratne 2015-02-04 12:38:43 +05:30
parent 50619593bd
commit 4e3cb71a4c
3 changed files with 61 additions and 26 deletions

View File

@ -12,6 +12,7 @@ phpMyAdmin - ChangeLog
- bug #4741 in ./libraries/Advisor.class.php#184 vsprintf(): Too few arguments
- bug #4743 Unable to move cursor with keyboard in filter rows box
- bug Incorrect link in doc
- bug #4745 Tracking does not handle views properly
4.3.8.0 (2015-01-24)
- bug Undefined constant PMA_DRIZZLE

View File

@ -45,11 +45,12 @@ function PMA_filterTracking(
*
* @param string $url_query url query
* @param int $last_version last version
* @param string $type type of the table; table, view or both
*
* @return string
*/
function PMA_getHtmlForDataDefinitionAndManipulationStatements($url_query,
$last_version
$last_version, $type = 'both'
) {
$html = '<div id="div_create_version">';
$html .= '<form method="post" action="tbl_tracking.php' . $url_query . '">';
@ -66,31 +67,54 @@ function PMA_getHtmlForDataDefinitionAndManipulationStatements($url_query,
. '" />';
$html .= '<p>' . __('Track these data definition statements:')
. '</p>';
$html .= '<input type="checkbox" name="alter_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'ALTER TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> ALTER TABLE<br/>';
$html .= '<input type="checkbox" name="rename_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'RENAME TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> RENAME TABLE<br/>';
$html .= '<input type="checkbox" name="create_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'CREATE TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> CREATE TABLE<br/>';
$html .= '<input type="checkbox" name="drop_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'DROP TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> DROP TABLE<br/>';
if ($type == 'both' || $type == 'table') {
$html .= '<input type="checkbox" name="alter_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'ALTER TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> ALTER TABLE<br/>';
$html .= '<input type="checkbox" name="rename_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'RENAME TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> RENAME TABLE<br/>';
$html .= '<input type="checkbox" name="create_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'CREATE TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> CREATE TABLE<br/>';
$html .= '<input type="checkbox" name="drop_table" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'DROP TABLE'
) !== false ? ' checked="checked"' : '')
. ' /> DROP TABLE<br/>';
} elseif ($type == 'both' || $type == 'view') {
$html .= '<input type="checkbox" name="alter_view" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'ALTER VIEW'
) !== false ? ' checked="checked"' : '')
. ' /> ALTER VIEW<br/>';
$html .= '<input type="checkbox" name="drop_view" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'DROP VIEW'
) !== false ? ' checked="checked"' : '')
. ' /> DROP VIEW<br/>';
$html .= '<input type="checkbox" name="create_view" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
'CREATE VIEW'
) !== false ? ' checked="checked"' : '')
. ' /> CREATE VIEW<br/>';
}
$html .= '<br/>';
$html .= '<input type="checkbox" name="create_index" value="true"'
. (/*overload*/mb_stripos(
$GLOBALS['cfg']['Server']['tracking_default_statements'],
@ -1200,6 +1224,15 @@ function PMA_getTrackingSet()
if (isset($_REQUEST['drop_table']) && $_REQUEST['drop_table'] == true) {
$tracking_set .= 'DROP TABLE,';
}
if (isset($_REQUEST['alter_view']) && $_REQUEST['alter_view'] == true) {
$tracking_set .= 'ALTER VIEW,';
}
if (isset($_REQUEST['create_view']) && $_REQUEST['create_view'] == true) {
$tracking_set .= 'CREATE VIEW,';
}
if (isset($_REQUEST['drop_view']) && $_REQUEST['drop_view'] == true) {
$tracking_set .= 'DROP VIEW,';
}
if (isset($_REQUEST['create_index']) && $_REQUEST['create_index'] == true) {
$tracking_set .= 'CREATE INDEX,';
}

View File

@ -143,8 +143,9 @@ if ($last_version > 0) {
);
}
$type = PMA_Table::isView($GLOBALS['db'], $GLOBALS['table']) ? 'view' : 'table';
$html .= PMA_getHtmlForDataDefinitionAndManipulationStatements(
$url_query, $last_version
$url_query, $last_version, $type
);
$html .= '<br class="clearfloat"/>';