Convert active check to variable.

We need to disable tracker for calling PMA_getRelationsParam. Well there
should be rather way to skip all queries done by control user, but this
information is not passed down to the DBI layer where tracker catches the SQL
queries.
This commit is contained in:
Michal Čihař
2009-08-25 13:44:14 +00:00
parent 158380c18a
commit a378720684
2 changed files with 28 additions and 4 deletions

View File

@@ -23,6 +23,11 @@ require_once './libraries/relation.lib.php';
*/
class PMA_Tracker
{
/**
* Whether tracking is ready.
*/
static protected $enabled = false;
/**
* Defines the internal PMA table which contains tracking data.
*
@@ -92,6 +97,17 @@ class PMA_Tracker
}
/**
* Actually enables tracking. This needs to be done after all
* underlaying code is initialized.
*
* @static
*
*/
static public function enable()
{
self::$enabled = true;
}
/**
* Gets the on/off value of the Tracker module, starts initialization.
@@ -102,8 +118,12 @@ class PMA_Tracker
*/
static public function isActive()
{
if (!defined('PHPMYADMIN_INIT_DONE')) return false;
if (!self::$enabled) return false;
/* We need to avoid attempt to track any queries from PMA_getRelationsParam */
self::$enabled = false;
$cfgRelation = PMA_getRelationsParam();
/* Restore original state */
self::$enabled = true;
if (!$cfgRelation['trackingwork']) return false;
self::init();
@@ -190,8 +210,12 @@ class PMA_Tracker
*/
static public function isTracked($dbname, $tablename)
{
if (!defined('PHPMYADMIN_INIT_DONE')) return false;
if (!self::$enabled) return false;
/* We need to avoid attempt to track any queries from PMA_getRelationsParam */
self::$enabled = false;
$cfgRelation = PMA_getRelationsParam();
/* Restore original state */
self::$enabled = true;
if (!$cfgRelation['trackingwork']) return false;
$sql_query =

View File

@@ -985,8 +985,8 @@ $_SESSION['PMA_Config']->set('blowfish_secret', '');
$_SESSION['PMA_Config']->set('Servers', '');
$_SESSION['PMA_Config']->set('default_server', '');
/* Flag that we have loaded all core libraries and set up the connections */
define('PHPMYADMIN_INIT_DONE', '42');
/* Tell tracker that it can actually work */
PMA_Tracker::enable();
if (!empty($__redirect) && in_array($__redirect, $goto_whitelist)) {
/**