2 /* vim: set expandtab sw=4 ts=4 sts=4: */
10 require_once './libraries/common.inc.php';
12 define('TABLE_MAY_BE_ABSENT', true);
13 require './libraries/tbl_common.inc.php';
14 $url_query .= '&goto=tbl_tracking.php&back=tbl_tracking.php';
15 $url_params['goto'] = 'tbl_tracking.php';;
16 $url_params['back'] = 'tbl_tracking.php';
18 // Init vars for tracking report
19 if (isset($_REQUEST['report']) ||
isset($_REQUEST['report_export'])) {
20 $data = PMA_Tracker
::getTrackedData(
21 $_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']
24 $selection_schema = false;
25 $selection_data = false;
26 $selection_both = false;
28 if (! isset($_REQUEST['logtype'])) {
29 $_REQUEST['logtype'] = 'schema_and_data';
31 if ($_REQUEST['logtype'] == 'schema') {
32 $selection_schema = true;
33 } elseif ($_REQUEST['logtype'] == 'data') {
34 $selection_data = true;
36 $selection_both = true;
38 if (! isset($_REQUEST['date_from'])) {
39 $_REQUEST['date_from'] = $data['date_from'];
41 if (! isset($_REQUEST['date_to'])) {
42 $_REQUEST['date_to'] = $data['date_to'];
44 if (! isset($_REQUEST['users'])) {
45 $_REQUEST['users'] = '*';
47 $filter_ts_from = strtotime($_REQUEST['date_from']);
48 $filter_ts_to = strtotime($_REQUEST['date_to']);
49 $filter_users = array_map('trim', explode(',', $_REQUEST['users']));
53 if (isset($_REQUEST['report_export'])) {
56 * Filters tracking entries
58 * @param array $data the entries to filter
59 * @param string $filter_ts_from "from" date
60 * @param string $filter_ts_to "to" date
61 * @param string $filter_users users
63 * @return array filtered entries
65 function PMA_filter_tracking(
66 $data, $filter_ts_from, $filter_ts_to, $filter_users
68 $tmp_entries = array();
70 foreach ( $data as $entry ) {
71 $timestamp = strtotime($entry['date']);
73 if ($timestamp >= $filter_ts_from
74 && $timestamp <= $filter_ts_to
75 && (in_array('*', $filter_users) ||
in_array($entry['username'], $filter_users))
77 $tmp_entries[] = array( 'id' => $id,
78 'timestamp' => $timestamp,
79 'username' => $entry['username'],
80 'statement' => $entry['statement']
89 // Filtering data definition statements
90 if ($_REQUEST['logtype'] == 'schema'
91 ||
$_REQUEST['logtype'] == 'schema_and_data'
93 $entries = array_merge(
96 $data['ddlog'], $filter_ts_from, $filter_ts_to, $filter_users
101 // Filtering data manipulation statements
102 if ($_REQUEST['logtype'] == 'data'
103 ||
$_REQUEST['logtype'] == 'schema_and_data'
105 $entries = array_merge(
108 $data['dmlog'], $filter_ts_from, $filter_ts_to, $filter_users
114 foreach ($entries as $key => $row) {
115 $ids[$key] = $row['id'];
116 $timestamps[$key] = $row['timestamp'];
117 $usernames[$key] = $row['username'];
118 $statements[$key] = $row['statement'];
122 $timestamps, SORT_ASC
, $ids, SORT_ASC
, $usernames,
123 SORT_ASC
, $statements, SORT_ASC
, $entries
128 // Export as file download
129 if (isset($_REQUEST['report_export'])
130 && $_REQUEST['export_type'] == 'sqldumpfile'
132 @ini_set
('url_rewriter.tags', '');
134 $dump = "# " . sprintf(
135 __('Tracking report for table `%s`'), htmlspecialchars($_REQUEST['table'])
137 . "\n" . "# " . date('Y-m-d H:i:s') . "\n";
138 foreach ($entries as $entry) {
139 $dump .= $entry['statement'];
141 $filename = 'log_' . htmlspecialchars($_REQUEST['table']) . '.sql';
142 PMA_downloadHeader($filename, 'text/x-sql', strlen($dump));
150 * Gets tables informations
159 // Create tracking version
160 if (isset($_REQUEST['submit_create_version'])) {
163 if ($_REQUEST['alter_table'] == true) {
164 $tracking_set .= 'ALTER TABLE,';
166 if ($_REQUEST['rename_table'] == true) {
167 $tracking_set .= 'RENAME TABLE,';
169 if ($_REQUEST['create_table'] == true) {
170 $tracking_set .= 'CREATE TABLE,';
172 if ($_REQUEST['drop_table'] == true) {
173 $tracking_set .= 'DROP TABLE,';
175 if ($_REQUEST['create_index'] == true) {
176 $tracking_set .= 'CREATE INDEX,';
178 if ($_REQUEST['drop_index'] == true) {
179 $tracking_set .= 'DROP INDEX,';
181 if ($_REQUEST['insert'] == true) {
182 $tracking_set .= 'INSERT,';
184 if ($_REQUEST['update'] == true) {
185 $tracking_set .= 'UPDATE,';
187 if ($_REQUEST['delete'] == true) {
188 $tracking_set .= 'DELETE,';
190 if ($_REQUEST['truncate'] == true) {
191 $tracking_set .= 'TRUNCATE,';
193 $tracking_set = rtrim($tracking_set, ',');
195 $versionCreated = PMA_Tracker
::createVersion(
198 $_REQUEST['version'],
200 PMA_Table
::isView($GLOBALS['db'], $GLOBALS['table'])
202 if ($versionCreated) {
203 $msg = PMA_Message
::success(
205 __('Version %1$s was created, tracking for %2$s is active.'),
206 htmlspecialchars($_REQUEST['version']),
207 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
214 // Deactivate tracking
215 if (isset($_REQUEST['submit_deactivate_now'])) {
216 $deactivated = PMA_Tracker
::deactivateTracking(
217 $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version']
220 $msg = PMA_Message
::success(
222 __('Tracking for %1$s was deactivated at version %2$s.'),
223 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']),
224 htmlspecialchars($_REQUEST['version'])
232 if (isset($_REQUEST['submit_activate_now'])) {
233 $activated = PMA_Tracker
::activateTracking(
234 $GLOBALS['db'], $GLOBALS['table'], $_REQUEST['version']
237 $msg = PMA_Message
::success(
239 __('Tracking for %1$s was activated at version %2$s.'),
240 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']),
241 htmlspecialchars($_REQUEST['version'])
248 // Export as SQL execution
249 if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'execution') {
250 foreach ($entries as $entry) {
251 $sql_result = PMA_DBI_query("/*NOTRACK*/\n" . $entry['statement']);
253 $msg = PMA_Message
::success(__('SQL statements executed.'));
257 // Export as SQL dump
258 if (isset($_REQUEST['report_export']) && $_REQUEST['export_type'] == 'sqldump') {
260 . __('You can execute the dump by creating and using a temporary database. Please ensure that you have the privileges to do so.')
262 . "# " . __('Comment out these two lines if you do not need them.') . "\n"
264 . "CREATE database IF NOT EXISTS pma_temp_db; \n"
265 . "USE pma_temp_db; \n"
268 foreach ($entries as $entry) {
269 $new_query .= $entry['statement'];
271 $msg = PMA_Message
::success(
272 __('SQL statements exported. Please copy the dump or execute it.')
277 $table_temp = $table;
280 include_once './libraries/sql_query_form.lib.php';
282 PMA_sqlQueryForm($new_query, 'sql');
285 $table = $table_temp;
291 if (isset($_REQUEST['snapshot'])) {
292 echo '<h3>' . __('Structure snapshot')
293 . ' [<a href="tbl_tracking.php?' . $url_query . '">' . __('Close')
295 $data = PMA_Tracker
::getTrackedData(
296 $_REQUEST['db'], $_REQUEST['table'], $_REQUEST['version']
299 // Get first DROP TABLE/VIEW and CREATE TABLE/VIEW statements
300 $drop_create_statements = $data['ddlog'][0]['statement'];
302 if (strstr($data['ddlog'][0]['statement'], 'DROP TABLE')
303 ||
strstr($data['ddlog'][0]['statement'], 'DROP VIEW')
305 $drop_create_statements .= $data['ddlog'][1]['statement'];
308 echo PMA_Util
::getMessage(
310 __('Version %s snapshot (SQL code)'),
311 htmlspecialchars($_REQUEST['version'])
313 $drop_create_statements
316 // Unserialize snapshot
317 $temp = unserialize($data['schema_snapshot']);
318 $columns = $temp['COLUMNS'];
319 $indexes = $temp['INDEXES'];
320 echo '<h3>' . __('Structure') . '</h3>';
321 echo '<table id="tablestructure" class="data">';
324 echo '<th>' . __('Column') . '</th>';
325 echo '<th>' . __('Type') . '</th>';
326 echo '<th>' . __('Collation') . '</th>';
327 echo '<th>' . __('Null') . '</th>';
328 echo '<th>' . __('Default') . '</th>';
329 echo '<th>' . __('Extra') . '</th>';
330 echo '<th>' . __('Comment') . '</th>';
335 foreach ($columns as $field_index => $field) {
336 echo '<tr class="noclick ' . $style . '">';
337 if ($field['Key'] == 'PRI') {
338 echo '<td><b><u>' . htmlspecialchars($field['Field']) . '</u></b></td>';
340 echo '<td><b>' . htmlspecialchars($field['Field']) . '</b></td>';
343 echo '<td>' . htmlspecialchars($field['Type']) . '</td>';
344 echo '<td>' . htmlspecialchars($field['Collation']) . '</td>';
345 echo '<td>' . (($field['Null'] == 'YES') ?
__('Yes') : __('No')) . '</td>';
347 if (isset($field['Default'])) {
348 $extracted_columnspec = PMA_Util
::extractColumnSpec($field['Type']);
349 if ($extracted_columnspec['type'] == 'bit') {
350 // here, $field['Default'] contains something like b'010'
351 echo PMA_Util
::convertBitDefaultValue($field['Default']);
353 echo htmlspecialchars($field['Default']);
356 if ($field['Null'] == 'YES') {
359 echo '<i>' . _pgettext('None for default', 'None') . '</i>';
363 echo '<td>' . htmlspecialchars($field['Extra']) . '</td>';
364 echo '<td>' . htmlspecialchars($field['Comment']) . '</td>';
367 if ($style == 'even') {
377 if (count($indexes) > 0) {
378 echo '<h3>' . __('Indexes') . '</h3>';
379 echo '<table id="tablestructure_indexes" class="data">';
382 echo '<th>' . __('Keyname') . '</th>';
383 echo '<th>' . __('Type') . '</th>';
384 echo '<th>' . __('Unique') . '</th>';
385 echo '<th>' . __('Packed') . '</th>';
386 echo '<th>' . __('Column') . '</th>';
387 echo '<th>' . __('Cardinality') . '</th>';
388 echo '<th>' . __('Collation') . '</th>';
389 echo '<th>' . __('Null') . '</th>';
390 echo '<th>' . __('Comment') . '</th>';
395 foreach ($indexes as $indexes_index => $index) {
396 if ($index['Non_unique'] == 0) {
397 $str_unique = __('Yes');
399 $str_unique = __('No');
401 if ($index['Packed'] != '') {
402 $str_packed = __('Yes');
404 $str_packed = __('No');
407 echo '<tr class="noclick ' . $style . '">';
408 echo '<td><b>' . htmlspecialchars($index['Key_name']) . '</b></td>';
409 echo '<td>' . htmlspecialchars($index['Index_type']) . '</td>';
410 echo '<td>' . $str_unique . '</td>';
411 echo '<td>' . $str_packed . '</td>';
412 echo '<td>' . htmlspecialchars($index['Column_name']) . '</td>';
413 echo '<td>' . htmlspecialchars($index['Cardinality']) . '</td>';
414 echo '<td>' . htmlspecialchars($index['Collation']) . '</td>';
415 echo '<td>' . htmlspecialchars($index['Null']) . '</td>';
416 echo '<td>' . htmlspecialchars($index['Comment']) . '</td>';
419 if ($style == 'even') {
428 echo '<br /><hr /><br />';
430 // end of snapshot report
435 if (isset($_REQUEST['report'])
436 && (isset($_REQUEST['delete_ddlog']) ||
isset($_REQUEST['delete_dmlog']))
439 if (isset($_REQUEST['delete_ddlog'])) {
441 // Delete ddlog row data
442 $delete_id = $_REQUEST['delete_ddlog'];
444 // Only in case of valable id
445 if ($delete_id == (int)$delete_id) {
446 unset($data['ddlog'][$delete_id]);
448 $successfullyDeleted = PMA_Tracker
::changeTrackingData(
449 $_REQUEST['db'], $_REQUEST['table'],
450 $_REQUEST['version'], 'DDL', $data['ddlog']
452 if ($successfullyDeleted) {
453 $msg = PMA_Message
::success(
454 __('Tracking data definition successfully deleted')
457 $msg = PMA_Message
::rawError(__('Query error'));
463 if (isset($_REQUEST['delete_dmlog'])) {
465 // Delete dmlog row data
466 $delete_id = $_REQUEST['delete_dmlog'];
468 // Only in case of valable id
469 if ($delete_id == (int)$delete_id) {
470 unset($data['dmlog'][$delete_id]);
472 $successfullyDeleted = PMA_Tracker
::changeTrackingData(
473 $_REQUEST['db'], $_REQUEST['table'],
474 $_REQUEST['version'], 'DML', $data['dmlog']
476 if ($successfullyDeleted) {
477 $msg = PMA_Message
::success(
478 __('Tracking data manipulation successfully deleted')
481 $msg = PMA_Message
::rawError(__('Query error'));
488 if (isset($_REQUEST['report']) ||
isset($_REQUEST['report_export'])) {
489 echo '<h3>' . __('Tracking report')
490 . ' [<a href="tbl_tracking.php?' . $url_query . '">' . __('Close')
493 echo '<small>' . __('Tracking statements') . ' '
494 . htmlspecialchars($data['tracking']) . '</small><br/>';
497 echo '<form method="post" action="tbl_tracking.php'
498 . PMA_generate_common_url(
499 $url_params +
array('report' => 'true', 'version' => $_REQUEST['version'])
503 $str1 = '<select name="logtype">'
504 . '<option value="schema"'
505 . ($selection_schema ?
' selected="selected"' : '') . '>'
506 . __('Structure only') . '</option>'
507 . '<option value="data"'
508 . ($selection_data ?
' selected="selected"' : ''). '>'
509 . __('Data only') . '</option>'
510 . '<option value="schema_and_data"'
511 . ($selection_both ?
' selected="selected"' : '') . '>'
512 . __('Structure and data') . '</option>'
514 $str2 = '<input type="text" name="date_from" value="'
515 . htmlspecialchars($_REQUEST['date_from']) . '" size="19" />';
516 $str3 = '<input type="text" name="date_to" value="'
517 . htmlspecialchars($_REQUEST['date_to']) . '" size="19" />';
518 $str4 = '<input type="text" name="users" value="'
519 . htmlspecialchars($_REQUEST['users']) . '" />';
520 $str5 = '<input type="hidden" name="list_report" value="1" />'
521 . '<input type="submit" value="' . __('Go') . '" />';
524 __('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'),
525 $str1, $str2, $str3, $str4, $str5
528 // Prepare delete link content here
529 $drop_image_or_text = '';
530 if (true == $GLOBALS['cfg']['PropertiesIconic']) {
531 $drop_image_or_text .= PMA_Util
::getImage(
532 'b_drop.png', __('Delete tracking data row from report')
535 if ('both' === $GLOBALS['cfg']['PropertiesIconic']
536 ||
false === $GLOBALS['cfg']['PropertiesIconic']
538 $drop_image_or_text .= __('Delete');
542 * First, list tracked data definition statements
545 if (count($data['ddlog']) == 0 && count($data['dmlog']) == 0) {
546 $msg = PMA_Message
::notice(__('No data'));
550 if ($selection_schema ||
$selection_both && count($data['ddlog']) > 0) {
551 echo '<table id="ddl_versions" class="data" width="100%">';
554 echo '<th width="18">#</th>';
555 echo '<th width="100">' . __('Date') . '</th>';
556 echo '<th width="60">' . __('Username') . '</th>';
557 echo '<th>' . __('Data definition statement') . '</th>';
558 echo '<th>' . __('Delete') . '</th>';
564 foreach ($data['ddlog'] as $entry) {
565 if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
569 $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
572 $statement = PMA_Util
::formatSql(PMA_SQP_parse($entry['statement']));
574 $timestamp = strtotime($entry['date']);
576 if ($timestamp >= $filter_ts_from
577 && $timestamp <= $filter_ts_to
578 && (in_array('*', $filter_users) ||
in_array($entry['username'], $filter_users))
580 echo '<tr class="noclick ' . $style . '">';
581 echo '<td><small>' . $i . '</small></td>';
582 echo '<td><small>' . htmlspecialchars($entry['date']) . '</small></td>';
583 echo '<td><small>' . htmlspecialchars($entry['username']) . '</small></td>';
584 echo '<td>' . $statement . '</td>';
585 echo '<td class="nowrap"><a href="tbl_tracking.php?'
586 . $url_query . '&report=true&version='
587 . $version['version'] . '&delete_ddlog='
588 . ($i - 1) . '">' . $drop_image_or_text
592 if ($style == 'even') {
605 // Memorize data definition amount
609 * Secondly, list tracked data manipulation statements
612 if (($selection_data ||
$selection_both) && count($data['dmlog']) > 0) {
613 echo '<table id="dml_versions" class="data" width="100%">';
616 echo '<th width="18">#</th>';
617 echo '<th width="100">' . __('Date') . '</th>';
618 echo '<th width="60">' . __('Username') . '</th>';
619 echo '<th>' . __('Data manipulation statement') . '</th>';
620 echo '<th>' . __('Delete') . '</th>';
626 foreach ($data['dmlog'] as $entry) {
627 if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
631 $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
634 $statement = PMA_Util
::formatSql(PMA_SQP_parse($entry['statement']));
636 $timestamp = strtotime($entry['date']);
638 if ($timestamp >= $filter_ts_from
639 && $timestamp <= $filter_ts_to
640 && (in_array('*', $filter_users) ||
in_array($entry['username'], $filter_users))
642 echo '<tr class="noclick ' . $style . '">';
643 echo '<td><small>' . $i . '</small></td>';
644 echo '<td><small>' . htmlspecialchars($entry['date']) . '</small></td>';
645 echo '<td><small>' . htmlspecialchars($entry['username']) . '</small></td>';
646 echo '<td>' . $statement . '</td>';
647 echo '<td class="nowrap"><a href="tbl_tracking.php?' . $url_query
648 . '&report=true&version=' . $version['version']
649 . '&delete_dmlog=' . ($i - $ddlog_count) . '">'
650 . $drop_image_or_text
654 if ($style == 'even') {
666 echo '<form method="post" action="tbl_tracking.php'
667 . PMA_generate_common_url(
668 $url_params +
array('report' => 'true', 'version' => $_REQUEST['version'])
672 __('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'),
673 $str1, $str2, $str3, $str4, $str5
676 $str_export1 = '<select name="export_type">'
677 . '<option value="sqldumpfile">' . __('SQL dump (file download)') . '</option>'
678 . '<option value="sqldump">' . __('SQL dump') . '</option>'
679 . '<option value="execution" onclick="alert(\''
680 . PMA_escapeJsString(__('This option will replace your table and contained data.'))
681 .'\')">' . __('SQL execution') . '</option>' . '</select>';
683 $str_export2 = '<input type="hidden" name="report_export" value="1" />'
684 . '<input type="submit" value="' . __('Go') .'" />';
686 echo '<form class="disableAjax" method="post" action="tbl_tracking.php'
687 . PMA_generate_common_url(
688 $url_params +
array('report' => 'true', 'version' => $_REQUEST['version'])
691 echo '<input type="hidden" name="logtype" value="'
692 . htmlspecialchars($_REQUEST['logtype']) . '" />';
693 echo '<input type="hidden" name="date_from" value="'
694 . htmlspecialchars($_REQUEST['date_from']) . '" />';
695 echo '<input type="hidden" name="date_to" value="'
696 . htmlspecialchars($_REQUEST['date_to']) . '" />';
697 echo '<input type="hidden" name="users" value="'
698 . htmlspecialchars($_REQUEST['users']) . '" />';
699 echo "<br/>" . sprintf(__('Export as %s'), $str_export1)
700 . $str_export2 . "<br/>";
702 echo "<br/><br/><hr/><br/>\n";
707 * List selectable tables
710 $sql_query = " SELECT DISTINCT db_name, table_name FROM " .
711 PMA_Util
::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
712 PMA_Util
::backquote($GLOBALS['cfg']['Server']['tracking']) .
713 " WHERE db_name = '" . PMA_Util
::sqlAddSlashes($GLOBALS['db']) . "' " .
714 " ORDER BY db_name, table_name";
716 $sql_result = PMA_queryAsControlUser($sql_query);
718 if (PMA_DBI_numRows($sql_result) > 0) {
719 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
720 echo '<select name="table">';
721 while ($entries = PMA_DBI_fetchArray($sql_result)) {
722 if (PMA_Tracker
::isTracked($entries['db_name'], $entries['table_name'])) {
723 $status = ' (' . __('active') . ')';
725 $status = ' (' . __('not active') . ')';
727 if ($entries['table_name'] == $_REQUEST['table']) {
728 $s = ' selected="selected"';
732 echo '<option value="' . htmlspecialchars($entries['table_name']) . '"' . $s . '>' . htmlspecialchars($entries['db_name']) . ' . ' . htmlspecialchars($entries['table_name']) . $status . '</option>' . "\n";
735 echo '<input type="hidden" name="show_versions_submit" value="1" />';
736 echo '<input type="submit" value="' . __('Show versions') . '" />';
742 * List versions of current table
745 $sql_query = " SELECT * FROM " .
746 PMA_Util
::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
747 PMA_Util
::backquote($GLOBALS['cfg']['Server']['tracking']) .
748 " WHERE db_name = '" . PMA_Util
::sqlAddSlashes($_REQUEST['db']) . "' ".
749 " AND table_name = '" . PMA_Util
::sqlAddSlashes($_REQUEST['table']) ."' ".
750 " ORDER BY version DESC ";
752 $sql_result = PMA_queryAsControlUser($sql_query);
755 $maxversion = PMA_DBI_fetchArray($sql_result);
756 $last_version = $maxversion['version'];
758 if ($last_version > 0) {
759 echo '<table id="versions" class="data">';
762 echo '<th>' . __('Database') . '</th>';
763 echo '<th>' . __('Table') . '</th>';
764 echo '<th>' . __('Version') . '</th>';
765 echo '<th>' . __('Created') . '</th>';
766 echo '<th>' . __('Updated') . '</th>';
767 echo '<th>' . __('Status') . '</th>';
768 echo '<th>' . __('Show') . '</th>';
774 PMA_DBI_dataSeek($sql_result, 0);
775 while ($version = PMA_DBI_fetchArray($sql_result)) {
776 if ($version['tracking_active'] == 1) {
777 $version_status = __('active');
779 $version_status = __('not active');
781 if ($version['version'] == $last_version) {
782 if ($version['tracking_active'] == 1) {
783 $tracking_active = true;
785 $tracking_active = false;
788 echo '<tr class="noclick ' . $style . '">';
789 echo '<td>' . htmlspecialchars($version['db_name']) . '</td>';
790 echo '<td>' . htmlspecialchars($version['table_name']) . '</td>';
791 echo '<td>' . htmlspecialchars($version['version']) . '</td>';
792 echo '<td>' . htmlspecialchars($version['date_created']) . '</td>';
793 echo '<td>' . htmlspecialchars($version['date_updated']) . '</td>';
794 echo '<td>' . $version_status . '</td>';
795 echo '<td><a href="tbl_tracking.php';
796 echo PMA_generate_common_url(
797 $url_params +
array('report' => 'true', 'version' => $version['version'])
799 echo '">' . __('Tracking report') . '</a>';
800 echo '| <a href="tbl_tracking.php';
801 echo PMA_generate_common_url(
802 $url_params +
array('snapshot' => 'true', 'version' => $version['version'])
804 echo '">' . __('Structure snapshot') . '</a>';
808 if ($style == 'even') {
818 if ($tracking_active) {
819 echo '<div id="div_deactivate_tracking">';
820 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
824 __('Deactivate tracking for %s'),
825 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
828 echo '<input type="hidden" name="version" value="' . $last_version . '" />';
829 echo '<input type="hidden" name="submit_deactivate_now" value="1" />';
830 echo '<input type="submit" value="' . __('Deactivate now') . '" />';
835 echo '<div id="div_activate_tracking">';
836 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
840 __('Activate tracking for %s'),
841 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
844 echo '<input type="hidden" name="version" value="' . $last_version . '" />';
845 echo '<input type="hidden" name="submit_activate_now" value="1" />';
846 echo '<input type="submit" value="' . __('Activate now') . '" />';
853 echo '<div id="div_create_version">';
854 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
855 echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
859 __('Create version %1$s of %2$s'),
861 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
865 echo '<input type="hidden" name="version" value="' . ($last_version +
1) . '" />';
867 echo '<p>' . __('Track these data definition statements:') . '</p>';
868 echo '<input type="checkbox" name="alter_table" value="true" checked="checked" /> ALTER TABLE<br/>';
869 echo '<input type="checkbox" name="rename_table" value="true" checked="checked" /> RENAME TABLE<br/>';
870 echo '<input type="checkbox" name="create_table" value="true" checked="checked" /> CREATE TABLE<br/>';
871 echo '<input type="checkbox" name="drop_table" value="true" checked="checked" /> DROP TABLE<br/>';
873 echo '<input type="checkbox" name="create_index" value="true" checked="checked" /> CREATE INDEX<br/>';
874 echo '<input type="checkbox" name="drop_index" value="true" checked="checked" /> DROP INDEX<br/>';
875 echo '<p>' . __('Track these data manipulation statements:') . '</p>';
876 echo '<input type="checkbox" name="insert" value="true" checked="checked" /> INSERT<br/>';
877 echo '<input type="checkbox" name="update" value="true" checked="checked" /> UPDATE<br/>';
878 echo '<input type="checkbox" name="delete" value="true" checked="checked" /> DELETE<br/>';
879 echo '<input type="checkbox" name="truncate" value="true" checked="checked" /> TRUNCATE<br/>';
882 echo '<fieldset class="tblFooters">';
884 echo '<input type="hidden" name="submit_create_version" value="1" />';
885 echo '<input type="submit" value="' . __('Create version') . '" />';
890 echo '<br class="clearfloat"/>';