permit to see tracking info even for deleted tables; code cleanup
This commit is contained in:
@@ -442,10 +442,10 @@ class PMA_Tracker
|
|||||||
{
|
{
|
||||||
$sql_query =
|
$sql_query =
|
||||||
" UPDATE " . self::$pma_table .
|
" UPDATE " . self::$pma_table .
|
||||||
" SET " . PMA_backquote('tracking_active') . " = '" . $new_state . "' " .
|
" SET `tracking_active` = '" . $new_state . "' " .
|
||||||
" WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " .
|
" WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' " .
|
||||||
" AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' " .
|
" AND `table_name` = '" . PMA_sqlAddslashes($tablename) . "' " .
|
||||||
" AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' ";
|
" AND `version` = '" . PMA_sqlAddslashes($version) . "' ";
|
||||||
|
|
||||||
$result = PMA_query_as_controluser($sql_query);
|
$result = PMA_query_as_controluser($sql_query);
|
||||||
|
|
||||||
@@ -502,8 +502,8 @@ class PMA_Tracker
|
|||||||
{
|
{
|
||||||
$sql_query =
|
$sql_query =
|
||||||
" SELECT MAX(version) FROM " . self::$pma_table .
|
" SELECT MAX(version) FROM " . self::$pma_table .
|
||||||
" WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " .
|
" WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' " .
|
||||||
" AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) . "' ";
|
" AND `table_name` = '" . PMA_sqlAddslashes($tablename) . "' ";
|
||||||
|
|
||||||
if ($statement != "") {
|
if ($statement != "") {
|
||||||
$sql_query .= " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ;
|
$sql_query .= " AND FIND_IN_SET('" . $statement . "',tracking) > 0" ;
|
||||||
@@ -532,13 +532,16 @@ class PMA_Tracker
|
|||||||
*/
|
*/
|
||||||
static public function getTrackedData($dbname, $tablename, $version)
|
static public function getTrackedData($dbname, $tablename, $version)
|
||||||
{
|
{
|
||||||
$sql_query = " SELECT * FROM " . self::$pma_table .
|
if (! isset(self::$pma_table)) {
|
||||||
" WHERE " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' ";
|
self::init();
|
||||||
if (! empty($tablename)) {
|
|
||||||
$sql_query .= " AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($tablename) ."' ";
|
|
||||||
}
|
}
|
||||||
$sql_query .= " AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) ."' ".
|
$sql_query = " SELECT * FROM " . self::$pma_table .
|
||||||
" ORDER BY ". PMA_backquote('version') . " DESC ";
|
" WHERE `db_name` = '" . PMA_sqlAddslashes($dbname) . "' ";
|
||||||
|
if (! empty($tablename)) {
|
||||||
|
$sql_query .= " AND `table_name` = '" . PMA_sqlAddslashes($tablename) ."' ";
|
||||||
|
}
|
||||||
|
$sql_query .= " AND `version` = '" . PMA_sqlAddslashes($version) ."' ".
|
||||||
|
" ORDER BY `version` DESC ";
|
||||||
|
|
||||||
$mixed = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
|
$mixed = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query));
|
||||||
|
|
||||||
@@ -900,11 +903,11 @@ class PMA_Tracker
|
|||||||
" /*NOTRACK*/\n" .
|
" /*NOTRACK*/\n" .
|
||||||
" UPDATE " . self::$pma_table .
|
" UPDATE " . self::$pma_table .
|
||||||
" SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n" . PMA_sqlAddslashes($query) . "') ," .
|
" SET " . PMA_backquote($save_to) ." = CONCAT( " . PMA_backquote($save_to) . ",'\n" . PMA_sqlAddslashes($query) . "') ," .
|
||||||
" " . PMA_backquote('date_updated') . " = '" . $date . "' ";
|
" `date_updated` = '" . $date . "' ";
|
||||||
|
|
||||||
// If table was renamed we have to change the tablename attribute in pma_tracking too
|
// If table was renamed we have to change the tablename attribute in pma_tracking too
|
||||||
if ($result['identifier'] == 'RENAME TABLE') {
|
if ($result['identifier'] == 'RENAME TABLE') {
|
||||||
$sql_query .= ', ' . PMA_backquote('table_name') . ' = \'' . PMA_sqlAddslashes($result['tablename_after_rename']) . '\' ';
|
$sql_query .= ', `table_name` = \'' . PMA_sqlAddslashes($result['tablename_after_rename']) . '\' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the tracking information only for
|
// Save the tracking information only for
|
||||||
@@ -914,9 +917,9 @@ class PMA_Tracker
|
|||||||
// we want to track
|
// we want to track
|
||||||
$sql_query .=
|
$sql_query .=
|
||||||
" WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" .
|
" WHERE FIND_IN_SET('" . $result['identifier'] . "',tracking) > 0" .
|
||||||
" AND " . PMA_backquote('db_name') . " = '" . PMA_sqlAddslashes($dbname) . "' " .
|
" AND `db_name` = '" . PMA_sqlAddslashes($dbname) . "' " .
|
||||||
" AND " . PMA_backquote('table_name') . " = '" . PMA_sqlAddslashes($result['tablename']) . "' " .
|
" AND `table_name` = '" . PMA_sqlAddslashes($result['tablename']) . "' " .
|
||||||
" AND " . PMA_backquote('version') . " = '" . PMA_sqlAddslashes($version) . "' ";
|
" AND `version` = '" . PMA_sqlAddslashes($version) . "' ";
|
||||||
|
|
||||||
$result = PMA_query_as_controluser($sql_query);
|
$result = PMA_query_as_controluser($sql_query);
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ if (empty($is_db)) {
|
|||||||
}
|
}
|
||||||
} // end if (ensures db exists)
|
} // end if (ensures db exists)
|
||||||
|
|
||||||
if (empty($is_table) && !defined('PMA_SUBMIT_MULT')) {
|
if (empty($is_table) && !defined('PMA_SUBMIT_MULT') && ! defined('TABLE_MAY_BE_ABSENT')) {
|
||||||
// Not a valid table name -> back to the db_sql.php
|
// Not a valid table name -> back to the db_sql.php
|
||||||
|
|
||||||
if (strlen($table)) {
|
if (strlen($table)) {
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
require_once './libraries/common.inc.php';
|
require_once './libraries/common.inc.php';
|
||||||
require_once './libraries/Table.class.php';
|
require_once './libraries/Table.class.php';
|
||||||
|
|
||||||
|
define('TABLE_MAY_BE_ABSENT', true);
|
||||||
require './libraries/tbl_common.php';
|
require './libraries/tbl_common.php';
|
||||||
$url_query .= '&goto=tbl_tracking.php&back=tbl_tracking.php';
|
$url_query .= '&goto=tbl_tracking.php&back=tbl_tracking.php';
|
||||||
$url_params['goto'] = 'tbl_tracking.php';;
|
$url_params['goto'] = 'tbl_tracking.php';;
|
||||||
|
Reference in New Issue
Block a user