Exemplo n.º 1
0
 public function tokenToKey($matches)
 {
     $token = $matches[0];
     $key = "@K" . kString::generateStringId() . "K@";
     $this->tokensMap[$key] = $token;
     return $key;
 }
 private static function calculateId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; ++$i) {
         $id = $dc["id"] . '_' . kString::generateStringId();
         $existing_object = entryPeer::retrieveByPk($id);
         if (!$existing_object) {
             return $id;
         }
     }
     die;
 }
Exemplo n.º 3
0
 /**
  * generate unique string id for annotation
  */
 public function getUniqueAnnotationId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; $i++) {
         $id = $dc["id"] . '_' . kString::generateStringId();
         $existingObject = AnnotationPeer::retrieveByPK($id);
         if ($existingObject) {
             KalturaLog::log(__METHOD__ . ": id [{$id}] already exists");
         } else {
             return $id;
         }
     }
     throw new Exception("Could not find unique id for annotation");
 }
Exemplo n.º 4
0
 /**
  * generate unique string id for CuePoint
  */
 private function calculateId()
 {
     $currentDcId = kDataCenterMgr::getCurrentDcId();
     for ($i = 0; $i < 10; $i++) {
         $id = $currentDcId . '_' . kString::generateStringId();
         $existingObject = CuePointPeer::retrieveByPKNoFilter($id);
         if ($existingObject) {
             KalturaLog::log(__METHOD__ . ": id [{$id}] already exists");
         } else {
             return $id;
         }
     }
     throw new Exception("Could not find unique id for CuePoint");
 }
Exemplo n.º 5
0
 private function calculateId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; $i++) {
         $id = $dc["id"] . '_' . kString::generateStringId();
         $existingObject = AppTokenPeer::retrieveByPkNoFilter($id);
         if ($existingObject) {
             KalturaLog::log("ID [{$id}] already exists");
         } else {
             return $id;
         }
     }
     throw new Exception("Could not find unique id for AppToken");
 }
Exemplo n.º 6
0
 /**
  * @return int unique id per request
  */
 public function getUniqueRequestId()
 {
     if (!is_null(self::$uniqueRequestId)) {
         return self::$uniqueRequestId;
     }
     $dcId = kDataCenterMgr::getCurrentDcId();
     for ($i = 0; $i < 10; ++$i) {
         $requestId = $dcId . '_' . kString::generateStringId();
         $exists = AuditTrailPeer::retrieveByRequestId($requestId);
         if (!$exists) {
             self::$uniqueRequestId = $requestId;
             return self::$uniqueRequestId;
         }
     }
     throw new kAuditTrailException('Unable to generate unique id', kAuditTrailException::UNIQUE_ID_NOT_GENERATED);
 }
 protected function calculateId()
 {
     $allChars = '0123456789abcdefghijklmnopqrstuvwxyz';
     $dcChars = str_split($allChars, strlen($allChars) / count(kDataCenterMgr::getAllDcs()));
     $dc = kDataCenterMgr::getCurrentDc();
     $dcId = (int) $dc["id"];
     $currentDcChars = $dcChars[$dcId];
     for ($i = 0; $i < 10; $i++) {
         $dcChar = substr($currentDcChars, rand(0, strlen($currentDcChars) - 1), 1);
         if (!$dcChar) {
             $dcChar = '0';
         }
         $id = $dcChar . kString::generateStringId(3);
         $existingObject = ShortLinkPeer::retrieveByPK($id);
         if ($existingObject) {
             KalturaLog::log("id [{$id}] already exists");
         } else {
             return $id;
         }
     }
     throw new Exception("Could not find unique id for short link");
 }
 public static function calculateId($widget)
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; ++$i) {
         $id = $dc["id"] . '_' . kString::generateStringId();
         $existing_widget = widgetPeer::retrieveByPk($id);
         if (!$existing_widget) {
             return $id;
         }
     }
     die;
 }
Exemplo n.º 9
0
 private function calculateId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; $i++) {
         $id = $dc["id"] . '_' . kString::generateStringId();
         $existingObject = flavorAssetPeer::retrieveById($id);
         if ($existingObject) {
             KalturaLog::log(__METHOD__ . ": id [{$id}] already exists");
         } else {
             return $id;
         }
     }
     throw new Exception("Could not find unique id for flavorAsset");
 }