get('thriftHost'); $port = $params->get('thriftPort'); $socket = new TSocket($host, $port); $socket->setRecvTimeout(10000); $_transport = new TBufferedTransport($socket); $protocol = new TBinaryProtocol($_transport); $_client = new OpenAireConnectorClient($protocol); return array("client" => $_client, "transport" => $_transport); } public static function getStats($params) { $thrift = modOpenAireStatsHelper::setupThrift($params); // Open up the connection $thrift["transport"]->open(); // $list = $thrift["client"]->getPublicationStatistics(); $cache = & JFactory::getCache('mod_openairestats', 'callback'); $conf =& JFactory::getConfig(); $cacheactive = $conf->getValue('config.caching'); $cache->setCaching(1); //enable caching $list = $cache->call(array($thrift['client'], 'getPublicationStatistics')); $cache->setCaching($cacheactive); $thrift["transport"]->close(); return $list; } } function compareStatLines($line1, $line2) { $v1 = $line1->values[0]->value; $v2 = $line2->values[0]->value; if ($v1 == $v2) return 0; else return ($v1 < $v2 ?-1:1); } ?>