当前位置: 首页>>代码示例>>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;未经允许,请勿转载。