From a378720684cb2ba2e1822b9a984606b7d8492074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 25 Aug 2009 13:44:14 +0000 Subject: [PATCH] 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. --- libraries/Tracker.class.php | 28 ++++++++++++++++++++++++++-- libraries/common.inc.php | 4 ++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/libraries/Tracker.class.php b/libraries/Tracker.class.php index bccef8b6a..735653a77 100644 --- a/libraries/Tracker.class.php +++ b/libraries/Tracker.class.php @@ -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 = diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 7326af70c..d30404b25 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -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)) { /**