public static function isTracked($dbname, $tablename)
{
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 = " SELECT tracking_active FROM " . self::_getTrackingTable() . " WHERE db_name = '" . $GLOBALS['dbi']->escapeString($dbname) . "' " . " AND table_name = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " . " ORDER BY version DESC LIMIT 1";
$result = $GLOBALS['dbi']->fetchValue($sql_query);
return $result == 1;
}
/** * Returns the tracking icon if the table is tracked * * @param string $table table name * * @return string HTML for tracking icon */ protected function getTrackingIcon($table) { $tracking_icon = ''; if (Tracker::isActive()) { $is_tracked = Tracker::isTracked($GLOBALS["db"], $table); if ($is_tracked || Tracker::getVersion($GLOBALS["db"], $table) > 0) { $tracking_icon = Template::get('database/structure/tracking_icon')->render(array('url_query' => $this->_url_query, 'truename' => $table, 'is_tracked' => $is_tracked)); } } return $tracking_icon; }