當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhabricatorHash::digestToLength方法代碼示例

本文整理匯總了PHP中PhabricatorHash::digestToLength方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhabricatorHash::digestToLength方法的具體用法?PHP PhabricatorHash::digestToLength怎麽用?PHP PhabricatorHash::digestToLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhabricatorHash的用法示例。


在下文中一共展示了PhabricatorHash::digestToLength方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getBuiltinFileKey

 public function getBuiltinFileKey()
 {
     $name = $this->getName();
     $desc = "disk(name={$name})";
     $hash = PhabricatorHash::digestToLength($desc, 40);
     return "builtin:{$hash}";
 }
開發者ID:truSense,項目名稱:phabricator,代碼行數:7,代碼來源:PhabricatorFilesOnDiskBuiltinFile.php

示例2: getBuiltinFileKey

 public function getBuiltinFileKey()
 {
     $icon = $this->getIcon();
     $color = $this->getColor();
     $desc = "compose(icon={$icon}, color={$color})";
     $hash = PhabricatorHash::digestToLength($desc, 40);
     return "builtin:{$hash}";
 }
開發者ID:truSense,項目名稱:phabricator,代碼行數:8,代碼來源:PhabricatorFilesComposeIconBuiltinFile.php

示例3: newLock

 public static function newLock($name)
 {
     $namespace = PhabricatorLiskDAO::getStorageNamespace();
     $namespace = PhabricatorHash::digestToLength($namespace, 20);
     $full_name = 'ph:' . $namespace . ':' . $name;
     $length_limit = 64;
     if (strlen($full_name) > $length_limit) {
         throw new Exception(pht('Lock name "%s" is too long (full lock name is "%s"). The ' . 'full lock name must not be longer than %s bytes.', $name, $full_name, new PhutilNumber($length_limit)));
     }
     $lock = self::getLock($full_name);
     if (!$lock) {
         $lock = new PhabricatorGlobalLock($full_name);
         self::registerLock($lock);
     }
     return $lock;
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:16,代碼來源:PhabricatorGlobalLock.php

示例4: importFromSource

 public final function importFromSource()
 {
     if (!$this->shouldPullDataFromSource()) {
         return false;
     }
     $source = $this->getSource();
     $key = $this->getCursorKey();
     $parts = array('nsc', $source->getID(), PhabricatorHash::digestToLength($key, 20));
     $lock_name = implode('.', $parts);
     $lock = PhabricatorGlobalLock::newLock($lock_name);
     $lock->lock(1);
     try {
         $more_data = $this->pullDataFromSource();
     } catch (Exception $ex) {
         $lock->unlock();
         throw $ex;
     }
     $lock->unlock();
     return $more_data;
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:20,代碼來源:NuanceImportCursor.php

示例5: getFieldsForObject

 public function getFieldsForObject($object)
 {
     $field_list = PhabricatorCustomField::getObjectFields($object, PhabricatorCustomField::ROLE_HERALD);
     $field_list->setViewer(PhabricatorUser::getOmnipotentUser());
     $field_list->readFieldsFromStorage($object);
     $prefix = 'herald.custom/';
     $limit = self::getFieldConstantByteLimit();
     $map = array();
     foreach ($field_list->getFields() as $field) {
         $key = $field->getFieldKey();
         // NOTE: This use of digestToLength() isn't preferred (you should
         // normally digest a key unconditionally, so that it isn't possible to
         // arrange a collision) but preserves backward compatibility.
         $full_key = $prefix . $key;
         if (strlen($full_key) > $limit) {
             $full_key = PhabricatorHash::digestToLength($full_key, $limit);
         }
         $map[$full_key] = id(new PhabricatorCustomFieldHeraldField())->setCustomField($field);
     }
     return $map;
 }
開發者ID:rchicoli,項目名稱:phabricator,代碼行數:21,代碼來源:PhabricatorCustomFieldHeraldField.php

示例6: getCacheKey

 protected function getCacheKey($path)
 {
     return 'celerity:' . PhabricatorHash::digestToLength($path, 64);
 }
開發者ID:NeoArmageddon,項目名稱:phabricator,代碼行數:4,代碼來源:CelerityResourceController.php


注:本文中的PhabricatorHash::digestToLength方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。