當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。