Пример #1
0
 public function calculateId()
 {
     $dc = kDataCenterMgr::getCurrentDc();
     for ($i = 0; $i < 10; $i++) {
         $id = $dc["id"] . '_' . md5(microtime(true) . getmypid() . uniqid(rand(), true));
         $existingObject = UploadTokenPeer::retrieveByPKNoFilter($id);
         if (!$existingObject) {
             return $id;
         }
     }
     throw new Exception("Could not calculate unique id for upload token");
 }