示例#1
0
 /**
  * @param int $hostUid
  * @param int $transactionType
  * @param float $amount
  * @throws \UnexpectedValueException
  * @return int
  */
 public function insertMiscTransaction($hostUid, $transactionType, $amount)
 {
     TransactionTypeEnum::validate($transactionType);
     $out = null;
     $this->oracle->plsql('P_HOST_MISC_TX')->inInt($hostUid)->inInt($transactionType)->inDecimal($amount)->inString(null)->inInt(null)->outInt($out)->inInt(1)->inInt(null)->call();
     if ($out <= 0) {
         throw new \UnexpectedValueException('Could not bill HostUid ' . $hostUid . ' TransactionType ' . $transactionType . ' with amount ' . $amount);
     }
     return $out;
 }
示例#2
0
 /**
  * keeps session alive
  *
  * @param String $sid
  * @return bool
  */
 public function keepAlive($sid)
 {
     $login = $uid = $sektor = $result = null;
     $this->oracle->plsql('P_SESSION_TIME_STAMP_V7')->inString($sid)->outString($login, 20)->outInt($uid)->outInt($sektor)->outInt($result)->inInt(0)->call();
     $success = $result === 0;
     return $success;
 }
示例#3
0
 /**
 * logs in host
 *
 * @param string $login
 * @param string $password
 * @param string $remoteAddress
 * @param bool $isMasterAccount
 *
 *@return null|SessionDeprecated
 * @throws ForbiddenException
 * @throws SessionAlreadyExistsException
 * @throws UnauthorizedException
 */
 public function createSessionInOracle($login, $password, $remoteAddress, $isMasterAccount = false)
 {
     $session = null;
     $now = new DateTimeImmutable();
     $sessionId = '';
     $sid = '';
     $uid = 0;
     $returnValue = 0;
     $isMasterAccount = $isMasterAccount ? 1 : 0;
     $this->oracle->plsql('P_HOST_SENDERTOOL_LOGIN_V8')->inString($login)->inString($password)->inString($remoteAddress)->inString('')->outInt($sessionId)->outString($sid, 40)->inInt($isMasterAccount)->outInt($uid)->outInt($returnValue)->call();
     if ($returnValue >= 0) {
         $sessionData = ['uid' => $uid, 'userType' => $this->userFactory->getUserTypeById($uid), 'login' => $login, 'isMasterAccount' => $isMasterAccount, 'sid' => $sessionId, 'sessionType' => SessionTypeEnum::SID_SESSION, 'validFrom' => $now, 'validUntil' => $now->add(new DateInterval('PT' . SidSessionType::TIMEOUT_HOST . 'S')), 'remoteAddress' => $remoteAddress, 'active' => true];
         $session = SessionDeprecated::createFromArray($sessionData);
     } else {
         $this->handleError($returnValue, $login);
     }
     return $session;
 }
 /**
  * @param $sid
  * @return bool
  */
 private function oracleKeepAlive($sid)
 {
     $login = $uid = $sektor = $return = null;
     $this->oracle->plsql('P_SESSION_TIME_STAMP_V7')->inString($sid)->outString($login, 20)->outInt($uid)->outInt($sektor)->outInt($return)->inInt(0)->call();
     return $return === 0;
 }
示例#5
0
 /**
  * @param array $uids
  * @param int $ftrType
  */
 public function deleteFeatureForUids(array $uids, $ftrType)
 {
     $this->oracle->plsql('PKG_USER_FEATURE.MULTI_DELETE')->inArrayInt($uids)->inInt((int) $ftrType)->call();
 }