public static function isActive()
{
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;
}
$pma_table = self::_getTrackingTable();
if (isset($pma_table)) {
return true;
} else {
return false;
}
}
/** * Test for Tracker::isActive() * * @return void * @test */ public function testIsActive() { $attr = new \ReflectionProperty('PMA\\libraries\\Tracker', 'enabled'); $attr->setAccessible(true); $attr->setValue(false); $this->assertFalse(Tracker::isActive()); Tracker::enable(); $_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'trackingwork' => false); $this->assertFalse(Tracker::isActive()); $_SESSION['relation'][$GLOBALS['server']] = array('PMA_VERSION' => PMA_VERSION, 'trackingwork' => true, 'db' => 'pmadb', 'tracking' => 'tracking'); $this->assertTrue(Tracker::isActive()); }