当前位置: 首页>>代码示例>>PHP>>正文


PHP KalturaLog::Log方法代码示例

本文整理汇总了PHP中KalturaLog::Log方法的典型用法代码示例。如果您正苦于以下问题:PHP KalturaLog::Log方法的具体用法?PHP KalturaLog::Log怎么用?PHP KalturaLog::Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KalturaLog的用法示例。


在下文中一共展示了KalturaLog::Log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forceRollBack

 /**
  * Rollback the whole transaction, even if this is a nested rollback
  * and reset the nested transaction count to 0.
  * @return     boolean Whether operation was successful.
  */
 public function forceRollBack()
 {
     $return = true;
     $opcount = $this->getNestedTransactionCount();
     if ($opcount > 0) {
         if (class_exists("KalturaLog")) {
             KalturaLog::Log("called forceRollback");
         }
         // If we're in a transaction, always roll it back
         // regardless of nesting level.
         $return = parent::rollBack();
         // reset nested transaction count to 0 so that we don't
         // try to commit (or rollback) the transaction outside this scope.
         $this->nestedTransactionCount = 0;
     }
     return $return;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:22,代码来源:PropelPDO.php

示例2: initConnection

 /**
  * Opens a new PDO connection for passed-in db name.
  *
  * @param      array $conparams Connection paramters.
  * @param      string $name Datasource name.
  * @param      string $defaultClass The PDO subclass to instantiate if there is no explicit classname
  * 									specified in the connection params (default is Propel::CLASS_PROPEL_PDO)
  *
  * @return     PDO A database connection of the given class (PDO, PropelPDO, SlavePDO or user-defined)
  *
  * @throws     PropelException - if lower-level exception caught when trying to connect.
  */
 public static function initConnection($conparams, $name, $defaultClass = Propel::CLASS_PROPEL_PDO)
 {
     $dsn = $conparams['dsn'];
     if ($dsn === null) {
         throw new PropelException('No dsn specified in your connection parameters for datasource [' . $name . ']');
     }
     if (isset($conparams['classname']) && !empty($conparams['classname'])) {
         $classname = $conparams['classname'];
         if (!class_exists($classname)) {
             throw new PropelException('Unable to load specified PDO subclass: ' . $classname);
         }
     } else {
         $classname = $defaultClass;
     }
     $user = isset($conparams['user']) ? $conparams['user'] : null;
     $password = isset($conparams['password']) ? $conparams['password'] : null;
     // load any driver options from the config file
     // driver options are those PDO settings that have to be passed during the connection construction
     $driver_options = array();
     if (isset($conparams['options']) && is_array($conparams['options'])) {
         try {
             self::processDriverOptions($conparams['options'], $driver_options);
         } catch (PropelException $e) {
             throw new PropelException('Error processing driver options for datasource [' . $name . ']', $e);
         }
     }
     // add profiling info and multiple retries for initiating a connection
     // since we do not expect connection time to exceed 1 second and we do encounter tcp SYN packet drop
     // which results in 3 second connection (the retry on the SYN is set to 3 seconds in the linux kernel)
     // we try to connect up to 3 times setting a 1 second timeout on the first two attempts
     // if there already was a timeout setting on the connection we wont activate the above logic and continue with
     // the original flow of one connection attempt
     $connStartTime = microtime(true);
     if (!array_key_exists(PDO::ATTR_TIMEOUT, $driver_options)) {
         $driver_options[PDO::ATTR_TIMEOUT] = 1;
         $count = 3;
     } else {
         $count = 1;
     }
     for ($i = 1; $i <= $count; $i++) {
         try {
             if ($i > 1 && $i == $count) {
                 // remove the timeout on the last attempt of the a attempt loop
                 unset($driver_options[PDO::ATTR_TIMEOUT]);
             }
             $startTime = microtime(true);
             $con = new $classname($dsn, $user, $password, $driver_options);
             $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             break;
         } catch (PDOException $e) {
             $timeTook = microtime(true) - $startTime;
             if (class_exists("KalturaLog")) {
                 KalturaLog::Log("failed to connect [{$i}] [{$timeTook}] {$dsn}");
             }
             if ($i == $count || $timeTook < 1) {
                 throw new PropelException("Unable to open PDO connection dsn[{$dsn}] user[{$user}] password[{$password}]", $e);
             }
         }
     }
     if (class_exists("KalturaLog")) {
         KalturaLog::Log("total conn took " . (microtime(true) - $connStartTime) . " {$dsn}");
     }
     // load any connection options from the config file
     // connection attributes are those PDO flags that have to be set on the initialized connection
     if (isset($conparams['attributes']) && is_array($conparams['attributes'])) {
         $attributes = array();
         try {
             self::processDriverOptions($conparams['attributes'], $attributes);
         } catch (PropelException $e) {
             throw new PropelException('Error processing connection attributes for datasource [' . $name . ']', $e);
         }
         foreach ($attributes as $key => $value) {
             $con->setAttribute($key, $value);
         }
     }
     // initialize the connection using the settings provided in the config file. this could be a "SET NAMES <charset>" query for MySQL, for instance
     $adapter = self::getDB($name);
     $adapter->initConnection($con, isset($conparams['settings']) && is_array($conparams['settings']) ? $conparams['settings'] : array());
     return $con;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:92,代码来源:Propel.php


注:本文中的KalturaLog::Log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。