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


PHP Lock::is_locked_by_user方法代码示例

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


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

示例1: release_lock

 public static function release_lock($UID, $entity_type, $user)
 {
     // add record to lock table in order to specify that the kbit is no longer locked
     // NOTE: it is recomended to implement the lock in separated class
     if (Lock::is_locked($UID, $entity_type) == false) {
         debugLog::log("<i>[Lock::release_lock]:</i> cannot release lock of [" . $entity_type . "]: " . $UID . " because it is not locked");
         return false;
     }
     if (Lock::is_locked_by_user($UID, $entity_type, $user) == false) {
         debugLog::log("<i>[Lock::release_lock]:</i>cannot release lock of [" . $entity_type . "]: " . $UID . " because it is not locked by the same user");
         return false;
     }
     $dbObj = new dbAPI();
     // disable lock records
     $query = "UPDATE CONTENT_LOCK SET ENABLED = 0 WHERE LOCKED_UID = '" . $UID . "' AND ENTITY_TYPE = '" . $entity_type . "' AND LOCK_STATUS = 'LOCKED' AND ENABLED = 1 ";
     $results = $dbObj->run_query($dbObj->db_get_contentDB(), $query);
     if ($results == false) {
         debugLog::log("<i>[Lock::release_lock]:</i>cannot release lock of [" . $entity_type . "]: " . $UID . " because of database update error");
         return false;
     }
     // add release record
     $query = "INSERT INTO CONTENT_LOCK (LOCKED_UID, ENTITY_TYPE, ENABLED, LOCK_STATUS, USER_ID, CREATION_DATE) VALUES (" . $UID . ", '" . $entity_type . "', 1, 'UNLOCKED', " . $user . ",'" . date("Y-m-d H:i:s") . "')";
     return $dbObj->run_query($dbObj->db_get_contentDB(), $query) == true;
 }
开发者ID:radjybaba,项目名称:testserver,代码行数:24,代码来源:lock.php

示例2: get_related_Kbits

 /**
  * returns list of terms that are related to object
  * @param {array} $object_UID    array of type array("column_name"=>'DELIVERY_BASE_ID', "value"=>5)
  * @param {string} $link_type     The link type
  * @param {string} $tableName     Table name of the relation which depends on object type, e.g. R_LD2T, R_LK2T.
  * @param  {string} $lang          The required language, if no language is selected all languages will be returned
  * @return {array:terms}                array of terms
  */
 public static function get_related_Kbits($Delivery_UID, $user)
 {
     $NEEDED = array();
     $PROVIDED = array();
     $OTHERS = array();
     // get database name
     if (Lock::is_locked_by_user($Delivery_UID, 'DELIVERY_BASE', $user) == true) {
         $database_name = dbAPI::get_db_name('user');
     } else {
         $database_name = dbAPI::get_db_name('content');
     }
     $dbObj = new dbAPI();
     // get all needed and provide Kbits (as relation objects)
     $query = "SELECT * FROM R_LD2K where ENABLED = 1 AND (DELIVERY_BASE_ID = " . $Delivery_UID . ")";
     $results = $dbObj->db_select_query($database_name, $query);
     for ($i = 0; $i < count($results); $i++) {
         $curr_Kbit = Kbit::get_Kbit_details($results[$i]["KBIT_BASE_ID"], $user);
         if ($results[$i]["LINK_TYPE"] == 'NEEDED') {
             array_push($NEEDED, $curr_Kbit);
         } else {
             if ($results[$i]["LINK_TYPE"] == 'PROVIDED') {
                 array_push($PROVIDED, $curr_Kbit);
             } else {
                 array_push($OTHERS, $curr_Kbit);
             }
         }
     }
     $kbits = array("NEEDED" => $NEEDED, "PROVIDED" => $PROVIDED, "OTHERS" => $OTHERS);
     return $kbits;
 }
开发者ID:radjybaba,项目名称:testserver,代码行数:38,代码来源:relations.php

示例3: remove_Kbit_from_delivery

 public static function remove_Kbit_from_delivery($Kbit_UID, $Delivery_UID, $link_type, $user)
 {
     if (Lock::is_locked_by_user($Delivery_UID, 'DELIVERY_BASE', $user) == false) {
         debugLog::log("<i>[delivery.php:remove_term_from_Delivery]</i> Delivery (" . $Delivery_UID . ") is not locked by the user (" . $user . ")");
         return null;
     }
     $locking_user = Lock::get_locking_user($UID, 'KBIT_BASE');
     if ($locking_user != null && $locking_user["UID"] != $user) {
         debugLog::log("<i>[delivery.php:add_Kbit_to_delivery]</i> Kbit(" . $Kbit_UID . ") is locked by other user(" . $locking_user["UID"] . ")");
         return null;
     }
     return D2KRelation::remove_D2K_relation($Kbit_UID, $Delivery_UID, $link_type, 'user');
 }
开发者ID:radjybaba,项目名称:testserver,代码行数:13,代码来源:delivery.php

示例4: remove_term_from_Kbit

 public static function remove_term_from_Kbit($Kbit_UID, $term_UID, $link_type, $user)
 {
     if (Lock::is_locked_by_user($Kbit_UID, 'KBIT_BASE', $user) == false) {
         debugLog::log("<i>[Kbits.php:remove_term_from_Kbit]</i> Kbit (" . $Kbit_UID . ") is not locked by the user (" . $user . ")");
         return false;
     }
     O2TRelation::remove_O2T_relation(array("column_name" => 'KBIT_BASE_ID', "value" => $Kbit_UID), $term_UID, $link_type, 'R_LK2T', 'user');
     return true;
 }
开发者ID:radjybaba,项目名称:testserver,代码行数:9,代码来源:Kbits.php


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