/** * @action pingDatabase * @return bool Always true if database available and writeable */ function pingDatabaseAction() { $hostname = infraRequestUtils::getHostname(); $server = ApiServerPeer::retrieveByHostname($hostname); if (!$server) { $server = new ApiServer(); $server->setHostname($hostname); } $server->setUpdatedAt(time()); if (!$server->save()) { return false; } return true; }
protected static function set($key, array $value = array()) { $value[self::CACHE_VALUE_HOSTNAME] = infraRequestUtils::getHostname(); $value[self::CACHE_VALUE_TIME] = time(); $value[self::CACHE_VALUE_SESSION] = UniqueId::get(); $value[self::CACHE_VALUE_VERSION] = self::getCacheVersion(); $key = self::addCacheVersion($key); KalturaLog::debug("Key [{$key}]"); $cacheStores = self::getStores(); foreach ($cacheStores as $cacheStore) { /* @var $cacheStore kBaseCacheWrapper */ $cacheStore->set($key, $value); } }
public static function initApiMonitor($cached, $action, $partnerId, $clientTag = null) { if (is_null(self::$stream)) { self::init(); } if (!self::$stream) { return; } self::$apiStartTime = microtime(true); self::$basicEventInfo = array(self::FIELD_SERVER => infraRequestUtils::getHostname(), self::FIELD_IP_ADDRESS => infraRequestUtils::getRemoteAddress(), self::FIELD_PARTNER_ID => $partnerId, self::FIELD_ACTION => $action, self::FIELD_CLIENT_TAG => $clientTag); if (!$cached) { require_once __DIR__ . '/../../../../../infra/log/UniqueId.php'; self::$basicEventInfo[self::FIELD_UNIQUE_ID] = UniqueId::get(); } }