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)) { /**