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')) {
304 $drop_create_statements .= $data['ddlog'][1]['statement'];
307 echo PMA_Util
::getMessage(
309 __('Version %s snapshot (SQL code)'),
310 htmlspecialchars($_REQUEST['version'])
312 $drop_create_statements
315 // Unserialize snapshot
316 $temp = unserialize($data['schema_snapshot']);
317 $columns = $temp['COLUMNS'];
318 $indexes = $temp['INDEXES'];
319 echo '<h3>' . __('Structure') . '</h3>';
320 echo '<table id="tablestructure" class="data">';
323 echo '<th>' . __('Column') . '</th>';
324 echo '<th>' . __('Type') . '</th>';
325 echo '<th>' . __('Collation') . '</th>';
326 echo '<th>' . __('Null') . '</th>';
327 echo '<th>' . __('Default') . '</th>';
328 echo '<th>' . __('Extra') . '</th>';
329 echo '<th>' . __('Comment') . '</th>';
334 foreach ($columns as $field_index => $field) {
335 echo '<tr class="noclick ' . $style . '">';
336 if ($field['Key'] == 'PRI') {
337 echo '<td><b><u>' . htmlspecialchars($field['Field']) . '</u></b></td>';
339 echo '<td><b>' . htmlspecialchars($field['Field']) . '</b></td>';
342 echo '<td>' . htmlspecialchars($field['Type']) . '</td>';
343 echo '<td>' . htmlspecialchars($field['Collation']) . '</td>';
344 echo '<td>' . (($field['Null'] == 'YES') ?
__('Yes') : __('No')) . '</td>';
346 if (isset($field['Default'])) {
347 $extracted_columnspec = PMA_Util
::extractColumnSpec($field['Type']);
348 if ($extracted_columnspec['type'] == 'bit') {
349 // here, $field['Default'] contains something like b'010'
350 echo PMA_Util
::convertBitDefaultValue($field['Default']);
352 echo htmlspecialchars($field['Default']);
355 if ($field['Null'] == 'YES') {
358 echo '<i>' . _pgettext('None for default', 'None') . '</i>';
362 echo '<td>' . htmlspecialchars($field['Extra']) . '</td>';
363 echo '<td>' . htmlspecialchars($field['Comment']) . '</td>';
366 if ($style == 'even') {
376 if (count($indexes) > 0) {
377 echo '<h3>' . __('Indexes') . '</h3>';
378 echo '<table id="tablestructure_indexes" class="data">';
381 echo '<th>' . __('Keyname') . '</th>';
382 echo '<th>' . __('Type') . '</th>';
383 echo '<th>' . __('Unique') . '</th>';
384 echo '<th>' . __('Packed') . '</th>';
385 echo '<th>' . __('Column') . '</th>';
386 echo '<th>' . __('Cardinality') . '</th>';
387 echo '<th>' . __('Collation') . '</th>';
388 echo '<th>' . __('Null') . '</th>';
389 echo '<th>' . __('Comment') . '</th>';
394 foreach ($indexes as $indexes_index => $index) {
395 if ($index['Non_unique'] == 0) {
396 $str_unique = __('Yes');
398 $str_unique = __('No');
400 if ($index['Packed'] != '') {
401 $str_packed = __('Yes');
403 $str_packed = __('No');
406 echo '<tr class="noclick ' . $style . '">';
407 echo '<td><b>' . htmlspecialchars($index['Key_name']) . '</b></td>';
408 echo '<td>' . htmlspecialchars($index['Index_type']) . '</td>';
409 echo '<td>' . $str_unique . '</td>';
410 echo '<td>' . $str_packed . '</td>';
411 echo '<td>' . htmlspecialchars($index['Column_name']) . '</td>';
412 echo '<td>' . htmlspecialchars($index['Cardinality']) . '</td>';
413 echo '<td>' . htmlspecialchars($index['Collation']) . '</td>';
414 echo '<td>' . htmlspecialchars($index['Null']) . '</td>';
415 echo '<td>' . htmlspecialchars($index['Comment']) . '</td>';
418 if ($style == 'even') {
427 echo '<br /><hr /><br />';
429 // end of snapshot report
434 if (isset($_REQUEST['report'])
435 && (isset($_REQUEST['delete_ddlog']) ||
isset($_REQUEST['delete_dmlog']))
438 if (isset($_REQUEST['delete_ddlog'])) {
440 // Delete ddlog row data
441 $delete_id = $_REQUEST['delete_ddlog'];
443 // Only in case of valable id
444 if ($delete_id == (int)$delete_id) {
445 unset($data['ddlog'][$delete_id]);
447 $successfullyDeleted = PMA_Tracker
::changeTrackingData(
448 $_REQUEST['db'], $_REQUEST['table'],
449 $_REQUEST['version'], 'DDL', $data['ddlog']
451 if ($successfullyDeleted) {
452 $msg = PMA_Message
::success(
453 __('Tracking data definition successfully deleted')
456 $msg = PMA_Message
::rawError(__('Query error'));
462 if (isset($_REQUEST['delete_dmlog'])) {
464 // Delete dmlog row data
465 $delete_id = $_REQUEST['delete_dmlog'];
467 // Only in case of valable id
468 if ($delete_id == (int)$delete_id) {
469 unset($data['dmlog'][$delete_id]);
471 $successfullyDeleted = PMA_Tracker
::changeTrackingData(
472 $_REQUEST['db'], $_REQUEST['table'],
473 $_REQUEST['version'], 'DML', $data['dmlog']
475 if ($successfullyDeleted) {
476 $msg = PMA_Message
::success(
477 __('Tracking data manipulation successfully deleted')
480 $msg = PMA_Message
::rawError(__('Query error'));
487 if (isset($_REQUEST['report']) ||
isset($_REQUEST['report_export'])) {
488 echo '<h3>' . __('Tracking report')
489 . ' [<a href="tbl_tracking.php?' . $url_query . '">' . __('Close')
492 echo '<small>' . __('Tracking statements') . ' '
493 . htmlspecialchars($data['tracking']) . '</small><br/>';
496 echo '<form method="post" action="tbl_tracking.php'
497 . PMA_generate_common_url(
498 $url_params +
array('report' => 'true', 'version' => $_REQUEST['version'])
502 $str1 = '<select name="logtype">'
503 . '<option value="schema"'
504 . ($selection_schema ?
' selected="selected"' : '') . '>'
505 . __('Structure only') . '</option>'
506 . '<option value="data"'
507 . ($selection_data ?
' selected="selected"' : ''). '>'
508 . __('Data only') . '</option>'
509 . '<option value="schema_and_data"'
510 . ($selection_both ?
' selected="selected"' : '') . '>'
511 . __('Structure and data') . '</option>'
513 $str2 = '<input type="text" name="date_from" value="'
514 . htmlspecialchars($_REQUEST['date_from']) . '" size="19" />';
515 $str3 = '<input type="text" name="date_to" value="'
516 . htmlspecialchars($_REQUEST['date_to']) . '" size="19" />';
517 $str4 = '<input type="text" name="users" value="'
518 . htmlspecialchars($_REQUEST['users']) . '" />';
519 $str5 = '<input type="hidden" name="list_report" value="1" />'
520 . '<input type="submit" value="' . __('Go') . '" />';
523 __('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'),
524 $str1, $str2, $str3, $str4, $str5
527 // Prepare delete link content here
528 $drop_image_or_text = '';
529 if ('icons' == $GLOBALS['cfg']['ActionsLinksMode']) {
530 $drop_image_or_text .= PMA_Util
::getImage(
531 'b_drop.png', __('Delete tracking data row from report')
535 $GLOBALS['cfg']['ActionLinksMode'],
536 array('text', 'both')
539 $drop_image_or_text .= __('Delete');
543 * First, list tracked data definition statements
546 if (count($data['ddlog']) == 0 && count($data['dmlog']) == 0) {
547 $msg = PMA_Message
::notice(__('No data'));
551 if ($selection_schema ||
$selection_both && count($data['ddlog']) > 0) {
552 echo '<table id="ddl_versions" class="data" width="100%">';
555 echo '<th width="18">#</th>';
556 echo '<th width="100">' . __('Date') . '</th>';
557 echo '<th width="60">' . __('Username') . '</th>';
558 echo '<th>' . __('Data definition statement') . '</th>';
559 echo '<th>' . __('Delete') . '</th>';
565 foreach ($data['ddlog'] as $entry) {
566 if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
570 $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
573 $statement = PMA_Util
::formatSql(PMA_SQP_parse($entry['statement']));
575 $timestamp = strtotime($entry['date']);
577 if ($timestamp >= $filter_ts_from
578 && $timestamp <= $filter_ts_to
579 && (in_array('*', $filter_users) ||
in_array($entry['username'], $filter_users))
581 echo '<tr class="noclick ' . $style . '">';
582 echo '<td><small>' . $i . '</small></td>';
583 echo '<td><small>' . htmlspecialchars($entry['date']) . '</small></td>';
584 echo '<td><small>' . htmlspecialchars($entry['username']) . '</small></td>';
585 echo '<td>' . $statement . '</td>';
586 echo '<td class="nowrap"><a href="tbl_tracking.php?'
587 . PMA_generate_common_url(
590 'version' => $_REQUEST['version'],
591 'delete_ddlog' => ($i - 1),
594 . '">' . $drop_image_or_text
598 if ($style == 'even') {
611 // Memorize data definition amount
615 * Secondly, list tracked data manipulation statements
618 if (($selection_data ||
$selection_both) && count($data['dmlog']) > 0) {
619 echo '<table id="dml_versions" class="data" width="100%">';
622 echo '<th width="18">#</th>';
623 echo '<th width="100">' . __('Date') . '</th>';
624 echo '<th width="60">' . __('Username') . '</th>';
625 echo '<th>' . __('Data manipulation statement') . '</th>';
626 echo '<th>' . __('Delete') . '</th>';
632 foreach ($data['dmlog'] as $entry) {
633 if (strlen($entry['statement']) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
637 $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']
640 $statement = PMA_Util
::formatSql(PMA_SQP_parse($entry['statement']));
642 $timestamp = strtotime($entry['date']);
644 if ($timestamp >= $filter_ts_from
645 && $timestamp <= $filter_ts_to
646 && (in_array('*', $filter_users) ||
in_array($entry['username'], $filter_users))
648 echo '<tr class="noclick ' . $style . '">';
649 echo '<td><small>' . $i . '</small></td>';
650 echo '<td><small>' . htmlspecialchars($entry['date']) . '</small></td>';
651 echo '<td><small>' . htmlspecialchars($entry['username']) . '</small></td>';
652 echo '<td>' . $statement . '</td>';
653 echo '<td class="nowrap"><a href="tbl_tracking.php?'
654 . PMA_generate_common_url(
657 'version' => $_REQUEST['version'],
658 'delete_dmlog' => ($i - $ddlog_count),
662 . $drop_image_or_text
666 if ($style == 'even') {
678 echo '<form method="post" action="tbl_tracking.php'
679 . PMA_generate_common_url(
680 $url_params +
array('report' => 'true', 'version' => $_REQUEST['version'])
684 __('Show %1$s with dates from %2$s to %3$s by user %4$s %5$s'),
685 $str1, $str2, $str3, $str4, $str5
688 $str_export1 = '<select name="export_type">'
689 . '<option value="sqldumpfile">' . __('SQL dump (file download)') . '</option>'
690 . '<option value="sqldump">' . __('SQL dump') . '</option>'
691 . '<option value="execution" onclick="alert(\''
692 . PMA_escapeJsString(__('This option will replace your table and contained data.'))
693 .'\')">' . __('SQL execution') . '</option>' . '</select>';
695 $str_export2 = '<input type="hidden" name="report_export" value="1" />'
696 . '<input type="submit" value="' . __('Go') .'" />';
698 echo '<form class="disableAjax" method="post" action="tbl_tracking.php'
699 . PMA_generate_common_url(
700 $url_params +
array('report' => 'true', 'version' => $_REQUEST['version'])
703 echo '<input type="hidden" name="logtype" value="'
704 . htmlspecialchars($_REQUEST['logtype']) . '" />';
705 echo '<input type="hidden" name="date_from" value="'
706 . htmlspecialchars($_REQUEST['date_from']) . '" />';
707 echo '<input type="hidden" name="date_to" value="'
708 . htmlspecialchars($_REQUEST['date_to']) . '" />';
709 echo '<input type="hidden" name="users" value="'
710 . htmlspecialchars($_REQUEST['users']) . '" />';
711 echo "<br/>" . sprintf(__('Export as %s'), $str_export1)
712 . $str_export2 . "<br/>";
714 echo "<br/><br/><hr/><br/>\n";
719 * List selectable tables
722 $sql_query = " SELECT DISTINCT db_name, table_name FROM " .
723 PMA_Util
::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
724 PMA_Util
::backquote($GLOBALS['cfg']['Server']['tracking']) .
725 " WHERE db_name = '" . PMA_Util
::sqlAddSlashes($GLOBALS['db']) . "' " .
726 " ORDER BY db_name, table_name";
728 $sql_result = PMA_queryAsControlUser($sql_query);
730 if (PMA_DBI_num_rows($sql_result) > 0) {
731 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
732 echo '<select name="table">';
733 while ($entries = PMA_DBI_fetch_array($sql_result)) {
734 if (PMA_Tracker
::isTracked($entries['db_name'], $entries['table_name'])) {
735 $status = ' (' . __('active') . ')';
737 $status = ' (' . __('not active') . ')';
739 if ($entries['table_name'] == $_REQUEST['table']) {
740 $s = ' selected="selected"';
744 echo '<option value="' . htmlspecialchars($entries['table_name']) . '"' . $s . '>' . htmlspecialchars($entries['db_name']) . ' . ' . htmlspecialchars($entries['table_name']) . $status . '</option>' . "\n";
747 echo '<input type="hidden" name="show_versions_submit" value="1" />';
748 echo '<input type="submit" value="' . __('Show versions') . '" />';
754 * List versions of current table
757 $sql_query = " SELECT * FROM " .
758 PMA_Util
::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." .
759 PMA_Util
::backquote($GLOBALS['cfg']['Server']['tracking']) .
760 " WHERE db_name = '" . PMA_Util
::sqlAddSlashes($_REQUEST['db']) . "' ".
761 " AND table_name = '" . PMA_Util
::sqlAddSlashes($_REQUEST['table']) ."' ".
762 " ORDER BY version DESC ";
764 $sql_result = PMA_queryAsControlUser($sql_query);
767 $maxversion = PMA_DBI_fetch_array($sql_result);
768 $last_version = $maxversion['version'];
770 if ($last_version > 0) {
771 echo '<table id="versions" class="data">';
774 echo '<th>' . __('Database') . '</th>';
775 echo '<th>' . __('Table') . '</th>';
776 echo '<th>' . __('Version') . '</th>';
777 echo '<th>' . __('Created') . '</th>';
778 echo '<th>' . __('Updated') . '</th>';
779 echo '<th>' . __('Status') . '</th>';
780 echo '<th>' . __('Show') . '</th>';
786 PMA_DBI_data_seek($sql_result, 0);
787 while ($version = PMA_DBI_fetch_array($sql_result)) {
788 if ($version['tracking_active'] == 1) {
789 $version_status = __('active');
791 $version_status = __('not active');
793 if ($version['version'] == $last_version) {
794 if ($version['tracking_active'] == 1) {
795 $tracking_active = true;
797 $tracking_active = false;
800 echo '<tr class="noclick ' . $style . '">';
801 echo '<td>' . htmlspecialchars($version['db_name']) . '</td>';
802 echo '<td>' . htmlspecialchars($version['table_name']) . '</td>';
803 echo '<td>' . htmlspecialchars($version['version']) . '</td>';
804 echo '<td>' . htmlspecialchars($version['date_created']) . '</td>';
805 echo '<td>' . htmlspecialchars($version['date_updated']) . '</td>';
806 echo '<td>' . $version_status . '</td>';
807 echo '<td><a href="tbl_tracking.php';
808 echo PMA_generate_common_url(
809 $url_params +
array('report' => 'true', 'version' => $version['version'])
811 echo '">' . __('Tracking report') . '</a>';
812 echo '| <a href="tbl_tracking.php';
813 echo PMA_generate_common_url(
814 $url_params +
array('snapshot' => 'true', 'version' => $version['version'])
816 echo '">' . __('Structure snapshot') . '</a>';
820 if ($style == 'even') {
830 if ($tracking_active) {
831 echo '<div id="div_deactivate_tracking">';
832 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
836 __('Deactivate tracking for %s'),
837 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
840 echo '<input type="hidden" name="version" value="' . $last_version . '" />';
841 echo '<input type="hidden" name="submit_deactivate_now" value="1" />';
842 echo '<input type="submit" value="' . __('Deactivate now') . '" />';
847 echo '<div id="div_activate_tracking">';
848 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
852 __('Activate tracking for %s'),
853 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
856 echo '<input type="hidden" name="version" value="' . $last_version . '" />';
857 echo '<input type="hidden" name="submit_activate_now" value="1" />';
858 echo '<input type="submit" value="' . __('Activate now') . '" />';
865 echo '<div id="div_create_version">';
866 echo '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
867 echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']);
871 __('Create version %1$s of %2$s'),
873 htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table'])
877 echo '<input type="hidden" name="version" value="' . ($last_version +
1) . '" />';
879 echo '<p>' . __('Track these data definition statements:') . '</p>';
880 echo '<input type="checkbox" name="alter_table" value="true" checked="checked" /> ALTER TABLE<br/>';
881 echo '<input type="checkbox" name="rename_table" value="true" checked="checked" /> RENAME TABLE<br/>';
882 echo '<input type="checkbox" name="create_table" value="true" checked="checked" /> CREATE TABLE<br/>';
883 echo '<input type="checkbox" name="drop_table" value="true" checked="checked" /> DROP TABLE<br/>';
885 echo '<input type="checkbox" name="create_index" value="true" checked="checked" /> CREATE INDEX<br/>';
886 echo '<input type="checkbox" name="drop_index" value="true" checked="checked" /> DROP INDEX<br/>';
887 echo '<p>' . __('Track these data manipulation statements:') . '</p>';
888 echo '<input type="checkbox" name="insert" value="true" checked="checked" /> INSERT<br/>';
889 echo '<input type="checkbox" name="update" value="true" checked="checked" /> UPDATE<br/>';
890 echo '<input type="checkbox" name="delete" value="true" checked="checked" /> DELETE<br/>';
891 echo '<input type="checkbox" name="truncate" value="true" checked="checked" /> TRUNCATE<br/>';
894 echo '<fieldset class="tblFooters">';
896 echo '<input type="hidden" name="submit_create_version" value="1" />';
897 echo '<input type="submit" value="' . __('Create version') . '" />';
902 echo '<br class="clearfloat"/>';