@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Support Ferret engine for Passphrase credentials

Summary: Ref T12819. Adds Ferret support to Passphrase.

Test Plan: Indexed credentials, searched for credentials.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12819

Differential Revision: https://secure.phabricator.com/D18556

+116 -8
+9
resources/sql/autopatches/20170907.ferret.07.passphrase.doc.sql
··· 1 + CREATE TABLE {$NAMESPACE}_passphrase.passphrase_credential_fdocument ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + objectPHID VARBINARY(64) NOT NULL, 4 + isClosed BOOL NOT NULL, 5 + authorPHID VARBINARY(64), 6 + ownerPHID VARBINARY(64), 7 + epochCreated INT UNSIGNED NOT NULL, 8 + epochModified INT UNSIGNED NOT NULL 9 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+8
resources/sql/autopatches/20170907.ferret.08.passphrase.field.sql
··· 1 + CREATE TABLE {$NAMESPACE}_passphrase.passphrase_credential_ffield ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + fieldKey VARCHAR(4) NOT NULL COLLATE {$COLLATE_TEXT}, 5 + rawCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 6 + termCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT}, 7 + normalCorpus LONGTEXT NOT NULL COLLATE {$COLLATE_SORT} 8 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+5
resources/sql/autopatches/20170907.ferret.09.passphrase.ngrams.sql
··· 1 + CREATE TABLE {$NAMESPACE}_passphrase.passphrase_credential_fngrams ( 2 + id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, 3 + documentID INT UNSIGNED NOT NULL, 4 + ngram CHAR(3) NOT NULL COLLATE {$COLLATE_TEXT} 5 + ) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
+9
src/__phutil_library_map__.php
··· 1840 1840 'PassphraseCredentialDestroyController' => 'applications/passphrase/controller/PassphraseCredentialDestroyController.php', 1841 1841 'PassphraseCredentialDestroyTransaction' => 'applications/passphrase/xaction/PassphraseCredentialDestroyTransaction.php', 1842 1842 'PassphraseCredentialEditController' => 'applications/passphrase/controller/PassphraseCredentialEditController.php', 1843 + 'PassphraseCredentialFerretDocument' => 'applications/passphrase/storage/PassphraseCredentialFerretDocument.php', 1844 + 'PassphraseCredentialFerretEngine' => 'applications/passphrase/search/PassphraseCredentialFerretEngine.php', 1845 + 'PassphraseCredentialFerretField' => 'applications/passphrase/storage/PassphraseCredentialFerretField.php', 1846 + 'PassphraseCredentialFerretNgrams' => 'applications/passphrase/storage/PassphraseCredentialFerretNgrams.php', 1843 1847 'PassphraseCredentialFulltextEngine' => 'applications/passphrase/search/PassphraseCredentialFulltextEngine.php', 1844 1848 'PassphraseCredentialListController' => 'applications/passphrase/controller/PassphraseCredentialListController.php', 1845 1849 'PassphraseCredentialLockController' => 'applications/passphrase/controller/PassphraseCredentialLockController.php', ··· 7034 7038 'PhabricatorDestructibleInterface', 7035 7039 'PhabricatorSpacesInterface', 7036 7040 'PhabricatorFulltextInterface', 7041 + 'PhabricatorFerretInterface', 7037 7042 ), 7038 7043 'PassphraseCredentialAuthorPolicyRule' => 'PhabricatorPolicyRule', 7039 7044 'PassphraseCredentialConduitController' => 'PassphraseController', ··· 7044 7049 'PassphraseCredentialDestroyController' => 'PassphraseController', 7045 7050 'PassphraseCredentialDestroyTransaction' => 'PassphraseCredentialTransactionType', 7046 7051 'PassphraseCredentialEditController' => 'PassphraseController', 7052 + 'PassphraseCredentialFerretDocument' => 'PhabricatorFerretDocument', 7053 + 'PassphraseCredentialFerretEngine' => 'PhabricatorFerretEngine', 7054 + 'PassphraseCredentialFerretField' => 'PhabricatorFerretField', 7055 + 'PassphraseCredentialFerretNgrams' => 'PhabricatorFerretNgrams', 7047 7056 'PassphraseCredentialFulltextEngine' => 'PhabricatorFulltextEngine', 7048 7057 'PassphraseCredentialListController' => 'PassphraseController', 7049 7058 'PassphraseCredentialLockController' => 'PassphraseController',
+11 -7
src/applications/passphrase/query/PassphraseCredentialQuery.php
··· 109 109 if ($this->ids !== null) { 110 110 $where[] = qsprintf( 111 111 $conn, 112 - 'id IN (%Ld)', 112 + 'c.id IN (%Ld)', 113 113 $this->ids); 114 114 } 115 115 116 116 if ($this->phids !== null) { 117 117 $where[] = qsprintf( 118 118 $conn, 119 - 'phid IN (%Ls)', 119 + 'c.phid IN (%Ls)', 120 120 $this->phids); 121 121 } 122 122 123 123 if ($this->credentialTypes !== null) { 124 124 $where[] = qsprintf( 125 125 $conn, 126 - 'credentialType in (%Ls)', 126 + 'c.credentialType in (%Ls)', 127 127 $this->credentialTypes); 128 128 } 129 129 130 130 if ($this->providesTypes !== null) { 131 131 $where[] = qsprintf( 132 132 $conn, 133 - 'providesType IN (%Ls)', 133 + 'c.providesType IN (%Ls)', 134 134 $this->providesTypes); 135 135 } 136 136 137 137 if ($this->isDestroyed !== null) { 138 138 $where[] = qsprintf( 139 139 $conn, 140 - 'isDestroyed = %d', 140 + 'c.isDestroyed = %d', 141 141 (int)$this->isDestroyed); 142 142 } 143 143 144 144 if ($this->allowConduit !== null) { 145 145 $where[] = qsprintf( 146 146 $conn, 147 - 'allowConduit = %d', 147 + 'c.allowConduit = %d', 148 148 (int)$this->allowConduit); 149 149 } 150 150 151 151 if (strlen($this->nameContains)) { 152 152 $where[] = qsprintf( 153 153 $conn, 154 - 'LOWER(name) LIKE %~', 154 + 'LOWER(c.name) LIKE %~', 155 155 phutil_utf8_strtolower($this->nameContains)); 156 156 } 157 157 ··· 160 160 161 161 public function getQueryApplicationClass() { 162 162 return 'PhabricatorPassphraseApplication'; 163 + } 164 + 165 + protected function getPrimaryTableAlias() { 166 + return 'c'; 163 167 } 164 168 165 169 }
+22
src/applications/passphrase/search/PassphraseCredentialFerretEngine.php
··· 1 + <?php 2 + 3 + final class PassphraseCredentialFerretEngine 4 + extends PhabricatorFerretEngine { 5 + 6 + public function newNgramsObject() { 7 + return new PassphraseCredentialFerretNgrams(); 8 + } 9 + 10 + public function newDocumentObject() { 11 + return new PassphraseCredentialFerretDocument(); 12 + } 13 + 14 + public function newFieldObject() { 15 + return new PassphraseCredentialFerretField(); 16 + } 17 + 18 + public function newSearchEngine() { 19 + return new PassphraseCredentialSearchEngine(); 20 + } 21 + 22 + }
+10 -1
src/applications/passphrase/storage/PassphraseCredential.php
··· 8 8 PhabricatorSubscribableInterface, 9 9 PhabricatorDestructibleInterface, 10 10 PhabricatorSpacesInterface, 11 - PhabricatorFulltextInterface { 11 + PhabricatorFulltextInterface, 12 + PhabricatorFerretInterface { 12 13 13 14 protected $name; 14 15 protected $credentialType; ··· 194 195 195 196 public function newFulltextEngine() { 196 197 return new PassphraseCredentialFulltextEngine(); 198 + } 199 + 200 + 201 + /* -( PhabricatorFerretInterface )----------------------------------------- */ 202 + 203 + 204 + public function newFerretEngine() { 205 + return new PassphraseCredentialFerretEngine(); 197 206 } 198 207 199 208
+14
src/applications/passphrase/storage/PassphraseCredentialFerretDocument.php
··· 1 + <?php 2 + 3 + final class PassphraseCredentialFerretDocument 4 + extends PhabricatorFerretDocument { 5 + 6 + public function getApplicationName() { 7 + return 'passphrase'; 8 + } 9 + 10 + public function getIndexKey() { 11 + return 'credential'; 12 + } 13 + 14 + }
+14
src/applications/passphrase/storage/PassphraseCredentialFerretField.php
··· 1 + <?php 2 + 3 + final class PassphraseCredentialFerretField 4 + extends PhabricatorFerretField { 5 + 6 + public function getApplicationName() { 7 + return 'passphrase'; 8 + } 9 + 10 + public function getIndexKey() { 11 + return 'credential'; 12 + } 13 + 14 + }
+14
src/applications/passphrase/storage/PassphraseCredentialFerretNgrams.php
··· 1 + <?php 2 + 3 + final class PassphraseCredentialFerretNgrams 4 + extends PhabricatorFerretNgrams { 5 + 6 + public function getApplicationName() { 7 + return 'passphrase'; 8 + } 9 + 10 + public function getIndexKey() { 11 + return 'credential'; 12 + } 13 + 14 + }