PMA\libraries\Tracker::isActive PHP Method

isActive() public static method

Gets the on/off value of the Tracker module, starts initialization.
public static isActive ( ) : boolean
return boolean (true=on|false=off)
    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;
        }
    }

Usage Example

 /**
  * 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());
 }
All Usage Examples Of PMA\libraries\Tracker::isActive