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


PHP PhabricatorHash::digestForIndex方法代码示例

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


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

示例1: buildWhereClauseParts

 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'service.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'service.phid IN (%Ls)', $this->phids);
     }
     if ($this->names !== null) {
         $hashes = array();
         foreach ($this->names as $name) {
             $hashes[] = PhabricatorHash::digestForIndex($name);
         }
         $where[] = qsprintf($conn, 'service.nameIndex IN (%Ls)', $hashes);
     }
     if ($this->serviceTypes !== null) {
         $where[] = qsprintf($conn, 'service.serviceType IN (%Ls)', $this->serviceTypes);
     }
     if ($this->devicePHIDs !== null) {
         $where[] = qsprintf($conn, 'binding.devicePHID IN (%Ls)', $this->devicePHIDs);
     }
     if ($this->namePrefix !== null) {
         $where[] = qsprintf($conn, 'service.name LIKE %>', $this->namePrefix);
     }
     if ($this->nameSuffix !== null) {
         $where[] = qsprintf($conn, 'service.name LIKE %<', $this->nameSuffix);
     }
     return $where;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:30,代码来源:AlmanacServiceQuery.php

示例2: buildWhereClause

 protected function buildWhereClause(AphrontDatabaseConnection $conn_r)
 {
     $where = array();
     if ($this->ids !== null) {
         $where[] = qsprintf($conn_r, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn_r, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->names !== null) {
         $hashes = array();
         foreach ($this->names as $name) {
             $hashes[] = PhabricatorHash::digestForIndex($name);
         }
         $where[] = qsprintf($conn_r, 'nameIndex IN (%Ls)', $hashes);
     }
     if ($this->namePrefix !== null) {
         $where[] = qsprintf($conn_r, 'name LIKE %>', $this->namePrefix);
     }
     if ($this->nameSuffix !== null) {
         $where[] = qsprintf($conn_r, 'name LIKE %<', $this->nameSuffix);
     }
     $where[] = $this->buildPagingClause($conn_r);
     return $this->formatWhereClause($where);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:25,代码来源:AlmanacDeviceQuery.php

示例3: buildWhereClauseParts

 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->repositoryPHIDs !== null) {
         $where[] = qsprintf($conn, 'repositoryPHID IN (%Ls)', $this->repositoryPHIDs);
     }
     if ($this->refTypes !== null) {
         $where[] = qsprintf($conn, 'refType IN (%Ls)', $this->refTypes);
     }
     if ($this->refNames !== null) {
         $name_hashes = array();
         foreach ($this->refNames as $name) {
             $name_hashes[] = PhabricatorHash::digestForIndex($name);
         }
         $where[] = qsprintf($conn, 'refNameHash IN (%Ls)', $name_hashes);
     }
     if (strlen($this->datasourceQuery)) {
         $where[] = qsprintf($conn, 'refNameRaw LIKE %>', $this->datasourceQuery);
     }
     return $where;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:27,代码来源:PhabricatorRepositoryRefCursorQuery.php

示例4: buildWhereClause

 protected function buildWhereClause(AphrontDatabaseConnection $conn_r)
 {
     $where = array();
     if ($this->ids !== null) {
         $where[] = qsprintf($conn_r, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn_r, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->emailAddresses !== null) {
         $where[] = qsprintf($conn_r, 'emailAddress IN (%Ls)', $this->emailAddresses);
     }
     if ($this->verificationCodes !== null) {
         $hashes = array();
         foreach ($this->verificationCodes as $code) {
             $hashes[] = PhabricatorHash::digestForIndex($code);
         }
         $where[] = qsprintf($conn_r, 'verificationHash IN (%Ls)', $hashes);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn_r, 'authorPHID IN (%Ls)', $this->authorPHIDs);
     }
     $where[] = $this->buildPagingClause($conn_r);
     return $this->formatWhereClause($where);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:25,代码来源:PhabricatorAuthInviteQuery.php

示例5: getArtifactIndex

 public static function getArtifactIndex(HarbormasterBuildTarget $target, $artifact_key)
 {
     $build = $target->getBuild();
     $parts = array($build->getPHID(), $target->getBuildGeneration(), $artifact_key);
     $parts = implode("", $parts);
     return PhabricatorHash::digestForIndex($parts);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:7,代码来源:HarbormasterBuildArtifact.php

示例6: setRefName

 public function setRefName($ref_raw)
 {
     $this->setRefNameRaw($ref_raw);
     $this->setRefNameHash(PhabricatorHash::digestForIndex($ref_raw));
     $this->setRefNameEncoding($this->detectEncodingForStorage($ref_raw));
     return $this;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PhabricatorRepositoryPushLog.php

示例7: save

 public function save()
 {
     if (!$this->getVerificationHash()) {
         $hash = PhabricatorHash::digestForIndex($this->getVerificationCode());
         $this->setVerificationHash($hash);
     }
     return parent::save();
 }
开发者ID:truSense,项目名称:phabricator,代码行数:8,代码来源:PhabricatorAuthInvite.php

示例8: getIndexVersion

 public function getIndexVersion($object)
 {
     $ngrams = $object->newNgrams();
     $map = mpull($ngrams, 'getValue', 'getNgramKey');
     ksort($map);
     $serialized = serialize($map);
     return PhabricatorHash::digestForIndex($serialized);
 }
开发者ID:truSense,项目名称:phabricator,代码行数:8,代码来源:PhabricatorNgramsIndexEngineExtension.php

示例9: save

 public function save()
 {
     AlmanacNames::validateName($this->getName());
     $this->nameIndex = PhabricatorHash::digestForIndex($this->getName());
     if (!$this->mailKey) {
         $this->mailKey = Filesystem::readRandomCharacters(20);
     }
     return parent::save();
 }
开发者ID:Houzz,项目名称:phabricator,代码行数:9,代码来源:AlmanacDevice.php

示例10: doWork

 protected function doWork()
 {
     $resource_phid = $this->getTaskDataValue('resourcePHID');
     $hash = PhabricatorHash::digestForIndex($resource_phid);
     $lock_key = 'drydock.resource:' . $hash;
     $lock = PhabricatorGlobalLock::newLock($lock_key)->lock(1);
     $resource = $this->loadResource($resource_phid);
     $this->updateResource($resource);
     $lock->unlock();
 }
开发者ID:Robert-Xie,项目名称:phabricator,代码行数:10,代码来源:DrydockResourceUpdateWorker.php

示例11: clearCacheForAllUsers

 public static function clearCacheForAllUsers($key)
 {
     if (PhabricatorEnv::isReadOnly()) {
         return;
     }
     $table = new self();
     $conn_w = $table->establishConnection('w');
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     queryfx($conn_w, 'DELETE FROM %T WHERE cacheIndex = %s', $table->getTableName(), PhabricatorHash::digestForIndex($key));
     unset($unguarded);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:11,代码来源:PhabricatorUserCache.php

示例12: applyApplicationTransactionExternalEffects

 public function applyApplicationTransactionExternalEffects(PhabricatorApplicationTransaction $xaction)
 {
     $object = $this->getObject();
     $phid = $object->getPHID();
     $key = $this->getFieldKey();
     $property = id(new AlmanacPropertyQuery())->setViewer($this->getViewer())->withObjectPHIDs(array($phid))->withNames(array($key))->executeOne();
     if (!$property) {
         $property = id(new AlmanacProperty())->setObjectPHID($phid)->setFieldIndex(PhabricatorHash::digestForIndex($key))->setFieldName($key);
     }
     $property->setFieldValue($xaction->getNewValue())->save();
 }
开发者ID:pugong,项目名称:phabricator,代码行数:11,代码来源:AlmanacCoreCustomField.php

示例13: save

 public function save()
 {
     if ($this->getEngineClassName() === null) {
         throw new Exception(pht('Engine class is null.'));
     }
     // Instantiate the engine to make sure it's valid.
     $this->newEngine();
     $serial = $this->getEngineClassName() . serialize($this->parameters);
     $this->queryKey = PhabricatorHash::digestForIndex($serial);
     return parent::save();
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:11,代码来源:PhabricatorSavedQuery.php

示例14: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $show_prototypes = PhabricatorEnv::getEnvConfig('phabricator.show-prototypes');
     if (!$show_prototypes) {
         throw new Exception(pht('Show prototypes is disabled.
       Set `phabricator.show-prototypes` to `true` to use the image proxy'));
     }
     $viewer = $request->getViewer();
     $img_uri = $request->getStr('uri');
     // Validate the URI before doing anything
     PhabricatorEnv::requireValidRemoteURIForLink($img_uri);
     $uri = new PhutilURI($img_uri);
     $proto = $uri->getProtocol();
     if (!in_array($proto, array('http', 'https'))) {
         throw new Exception(pht('The provided image URI must be either http or https'));
     }
     // Check if we already have the specified image URI downloaded
     $cached_request = id(new PhabricatorFileExternalRequest())->loadOneWhere('uriIndex = %s', PhabricatorHash::digestForIndex($img_uri));
     if ($cached_request) {
         return $this->getExternalResponse($cached_request);
     }
     $ttl = PhabricatorTime::getNow() + phutil_units('7 days in seconds');
     $external_request = id(new PhabricatorFileExternalRequest())->setURI($img_uri)->setTTL($ttl);
     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
     // Cache missed so we'll need to validate and download the image
     try {
         // Rate limit outbound fetches to make this mechanism less useful for
         // scanning networks and ports.
         PhabricatorSystemActionEngine::willTakeAction(array($viewer->getPHID()), new PhabricatorFilesOutboundRequestAction(), 1);
         $file = PhabricatorFile::newFromFileDownload($uri, array('viewPolicy' => PhabricatorPolicies::POLICY_NOONE, 'canCDN' => true));
         if (!$file->isViewableImage()) {
             $mime_type = $file->getMimeType();
             $engine = new PhabricatorDestructionEngine();
             $engine->destroyObject($file);
             $file = null;
             throw new Exception(pht('The URI "%s" does not correspond to a valid image file, got ' . 'a file with MIME type "%s". You must specify the URI of a ' . 'valid image file.', $uri, $mime_type));
         } else {
             $file->save();
         }
         $external_request->setIsSuccessful(true)->setFilePHID($file->getPHID())->save();
         unset($unguarded);
         return $this->getExternalResponse($external_request);
     } catch (HTTPFutureHTTPResponseStatus $status) {
         $external_request->setIsSuccessful(false)->setResponseMessage($status->getMessage())->save();
         return $this->getExternalResponse($external_request);
     } catch (Exception $ex) {
         // Not actually saving the request in this case
         $external_request->setResponseMessage($ex->getMessage());
         return $this->getExternalResponse($external_request);
     }
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:51,代码来源:PhabricatorFileImageProxyController.php

示例15: setHeaders

 public function setHeaders(array $headers)
 {
     // Normalize headers to lowercase.
     $normalized = array();
     foreach ($headers as $name => $value) {
         $name = $this->normalizeMailHeaderName($name);
         if ($name == 'message-id') {
             $this->setMessageIDHash(PhabricatorHash::digestForIndex($value));
         }
         $normalized[$name] = $value;
     }
     $this->headers = $normalized;
     return $this;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:14,代码来源:PhabricatorMetaMTAReceivedMail.php


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