예제 #1
0
 /**
  * @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;
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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();
     }
 }