本文整理汇总了PHP中PhabricatorHash类的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorHash类的具体用法?PHP PhabricatorHash怎么用?PHP PhabricatorHash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PhabricatorHash类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBuiltinFileKey
public function getBuiltinFileKey()
{
$name = $this->getName();
$desc = "disk(name={$name})";
$hash = PhabricatorHash::digestToLength($desc, 40);
return "builtin:{$hash}";
}
示例2: 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;
}
示例3: 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);
}
示例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->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);
}
示例5: 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;
}
示例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;
}
示例7: 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);
}
示例8: getBuiltinFileKey
public function getBuiltinFileKey()
{
$icon = $this->getIcon();
$color = $this->getColor();
$desc = "compose(icon={$icon}, color={$color})";
$hash = PhabricatorHash::digestToLength($desc, 40);
return "builtin:{$hash}";
}
示例9: getIndexVersion
public function getIndexVersion($object)
{
$ngrams = $object->newNgrams();
$map = mpull($ngrams, 'getValue', 'getNgramKey');
ksort($map);
$serialized = serialize($map);
return PhabricatorHash::digestForIndex($serialized);
}
示例10: save
public function save()
{
if (!$this->getVerificationHash()) {
$hash = PhabricatorHash::digestForIndex($this->getVerificationCode());
$this->setVerificationHash($hash);
}
return parent::save();
}
示例11: getPasswordHashInput
private function getPasswordHashInput(PhutilOpaqueEnvelope $password, PhabricatorUser $user)
{
if ($user->getPHID() != $this->getUserPHID()) {
throw new Exception(pht('User does not match password user PHID!'));
}
$raw_input = PhabricatorHash::digestPassword($password, $user->getPHID());
return new PhutilOpaqueEnvelope($raw_input);
}
示例12: getMarkupFieldKey
/**
* @task markup
*/
public function getMarkupFieldKey($field)
{
if ($this->shouldUseMarkupCache($field)) {
$id = $this->getID();
} else {
$id = PhabricatorHash::digest($this->getMarkupText($field));
}
return "phriction:{$field}:{$id}";
}
示例13: 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();
}
示例14: newHTTPAuthorization
public static function newHTTPAuthorization(PhabricatorRepository $repository, PhabricatorUser $viewer, $operation)
{
$lfs_user = self::HTTP_USERNAME;
$lfs_pass = Filesystem::readRandomCharacters(32);
$lfs_hash = PhabricatorHash::digest($lfs_pass);
$ttl = PhabricatorTime::getNow() + phutil_units('1 day in seconds');
$token = id(new PhabricatorAuthTemporaryToken())->setTokenResource($repository->getPHID())->setTokenType(self::TOKENTYPE)->setTokenCode($lfs_hash)->setUserPHID($viewer->getPHID())->setTemporaryTokenProperty('lfs.operation', $operation)->setTokenExpires($ttl)->save();
$authorization_header = base64_encode($lfs_user . ':' . $lfs_pass);
return 'Basic ' . $authorization_header;
}
示例15: setSession
public function setSession($session)
{
// Store the hash of the session, not the actual session key, so that
// seeing the logs doesn't compromise all the sessions which appear in
// them. This just prevents casual leaks, like in a screenshot.
if (strlen($session)) {
$this->session = PhabricatorHash::digest($session);
}
return $this;
}