Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14056672
D15822.id38119.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D15822.id38119.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -793,6 +793,7 @@
'DiffusionRepositoryURIViewController' => 'applications/diffusion/controller/DiffusionRepositoryURIViewController.php',
'DiffusionRepositoryURIsIndexEngineExtension' => 'applications/diffusion/engineextension/DiffusionRepositoryURIsIndexEngineExtension.php',
'DiffusionRepositoryURIsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php',
+ 'DiffusionRepositoryURIsSearchEngineAttachment' => 'applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php',
'DiffusionRequest' => 'applications/diffusion/request/DiffusionRequest.php',
'DiffusionResolveRefsConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionResolveRefsConduitAPIMethod.php',
'DiffusionResolveUserQuery' => 'applications/diffusion/query/DiffusionResolveUserQuery.php',
@@ -5022,6 +5023,7 @@
'DiffusionRepositoryURIViewController' => 'DiffusionController',
'DiffusionRepositoryURIsIndexEngineExtension' => 'PhabricatorIndexEngineExtension',
'DiffusionRepositoryURIsManagementPanel' => 'DiffusionRepositoryManagementPanel',
+ 'DiffusionRepositoryURIsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'DiffusionRequest' => 'Phobject',
'DiffusionResolveRefsConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionResolveUserQuery' => 'Phobject',
@@ -7932,6 +7934,7 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
'PhabricatorExtendedPolicyInterface',
+ 'PhabricatorConduitResultInterface',
),
'PhabricatorRepositoryURIIndex' => 'PhabricatorRepositoryDAO',
'PhabricatorRepositoryURINormalizer' => 'Phobject',
diff --git a/src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php b/src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php
@@ -0,0 +1,34 @@
+<?php
+
+final class DiffusionRepositoryURIsSearchEngineAttachment
+ extends PhabricatorSearchEngineAttachment {
+
+ public function getAttachmentName() {
+ return pht('Repository URIs');
+ }
+
+ public function getAttachmentDescription() {
+ return pht('Get a list of associated URIs for each repository.');
+ }
+
+ public function willLoadAttachmentData($query, $spec) {
+ $query->needURIs(true);
+ }
+
+ public function getAttachmentForObject($object, $data, $spec) {
+ $uris = array();
+ foreach ($object->getURIs() as $uri) {
+ $uris[] = array(
+ 'id' => $uri->getID(),
+ 'type' => phid_get_type($uri->getPHID()),
+ 'phid' => $uri->getPHID(),
+ 'fields' => $uri->getFieldValuesForConduit(),
+ );
+ }
+
+ return array(
+ 'uris' => $uris,
+ );
+ }
+
+}
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -2454,6 +2454,10 @@
->setKey('shortName')
->setType('string')
->setDescription(pht('Unique short name, if the repository has one.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('status')
+ ->setType('string')
+ ->setDescription(pht('Active or inactive status.')),
);
}
@@ -2463,11 +2467,15 @@
'vcs' => $this->getVersionControlSystem(),
'callsign' => $this->getCallsign(),
'shortName' => $this->getRepositorySlug(),
+ 'status' => $this->getStatus(),
);
}
public function getConduitSearchAttachments() {
- return array();
+ return array(
+ id(new DiffusionRepositoryURIsSearchEngineAttachment())
+ ->setAttachmentKey('uris'),
+ );
}
}
diff --git a/src/applications/repository/storage/PhabricatorRepositoryURI.php b/src/applications/repository/storage/PhabricatorRepositoryURI.php
--- a/src/applications/repository/storage/PhabricatorRepositoryURI.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryURI.php
@@ -5,7 +5,8 @@
implements
PhabricatorApplicationTransactionInterface,
PhabricatorPolicyInterface,
- PhabricatorExtendedPolicyInterface {
+ PhabricatorExtendedPolicyInterface,
+ PhabricatorConduitResultInterface {
protected $repositoryPHID;
protected $uri;
@@ -512,4 +513,87 @@
return $extended;
}
+
+/* -( PhabricatorConduitResultInterface )---------------------------------- */
+
+
+ public function getFieldSpecificationsForConduit() {
+ return array(
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('repositoryPHID')
+ ->setType('phid')
+ ->setDescription(pht('The associated repository PHID.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('uri')
+ ->setType('map<string, string>')
+ ->setDescription(pht('The raw and effective URI.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('io')
+ ->setType('map<string, const>')
+ ->setDescription(
+ pht('The raw, default, and effective I/O Type settings.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('display')
+ ->setType('map<string, const>')
+ ->setDescription(
+ pht('The raw, default, and effective Display Type settings.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('credentialPHID')
+ ->setType('phid?')
+ ->setDescription(
+ pht('The associated credential PHID, if one exists.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('disabled')
+ ->setType('bool')
+ ->setDescription(pht('True if the URI is disabled.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('builtin')
+ ->setType('map<string, string>')
+ ->setDescription(
+ pht('Information about builtin URIs.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('dateCreated')
+ ->setType('int')
+ ->setDescription(
+ pht('Epoch timestamp when the object was created.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('dateModified')
+ ->setType('int')
+ ->setDescription(
+ pht('Epoch timestamp when the object was last updated.')),
+ );
+ }
+
+ public function getFieldValuesForConduit() {
+ return array(
+ 'repositoryPHID' => $this->getRepositoryPHID(),
+ 'uri' => array(
+ 'raw' => $this->getURI(),
+ 'effective' => (string)$this->getDisplayURI(),
+ ),
+ 'io' => array(
+ 'raw' => $this->getIOType(),
+ 'default' => $this->getDefaultIOType(),
+ 'effective' => $this->getEffectiveIOType(),
+ ),
+ 'display' => array(
+ 'raw' => $this->getDisplayType(),
+ 'default' => $this->getDefaultDisplayType(),
+ 'effective' => $this->getEffectiveDisplayType(),
+ ),
+ 'credentialPHID' => $this->getCredentialPHID(),
+ 'disabled' => (bool)$this->getIsDisabled(),
+ 'builtin' => array(
+ 'protocol' => $this->getBuiltinProtocol(),
+ 'identifier' => $this->getBuiltinIdentifier(),
+ ),
+ 'dateCreated' => $this->getDateCreated(),
+ 'dateModified' => $this->getDateModified(),
+ );
+ }
+
+ public function getConduitSearchAttachments() {
+ return array();
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 9:38 PM (1 d, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719935
Default Alt Text
D15822.id38119.diff (7 KB)
Attached To
Mode
D15822: Allow callers to query information about repository URIs from diffusion.repository.search
Attached
Detach File
Event Timeline
Log In to Comment