@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.

Allow callers to query information about repository URIs from diffusion.repository.search

Summary: Ref T10748. Adds a "uris" attachment with URI information.

Test Plan: Queried URI information via Conduit, saw reasonable looking information.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10748

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

+131 -2
+3
src/__phutil_library_map__.php
··· 793 793 'DiffusionRepositoryURIViewController' => 'applications/diffusion/controller/DiffusionRepositoryURIViewController.php', 794 794 'DiffusionRepositoryURIsIndexEngineExtension' => 'applications/diffusion/engineextension/DiffusionRepositoryURIsIndexEngineExtension.php', 795 795 'DiffusionRepositoryURIsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php', 796 + 'DiffusionRepositoryURIsSearchEngineAttachment' => 'applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php', 796 797 'DiffusionRequest' => 'applications/diffusion/request/DiffusionRequest.php', 797 798 'DiffusionResolveRefsConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionResolveRefsConduitAPIMethod.php', 798 799 'DiffusionResolveUserQuery' => 'applications/diffusion/query/DiffusionResolveUserQuery.php', ··· 5022 5023 'DiffusionRepositoryURIViewController' => 'DiffusionController', 5023 5024 'DiffusionRepositoryURIsIndexEngineExtension' => 'PhabricatorIndexEngineExtension', 5024 5025 'DiffusionRepositoryURIsManagementPanel' => 'DiffusionRepositoryManagementPanel', 5026 + 'DiffusionRepositoryURIsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 5025 5027 'DiffusionRequest' => 'Phobject', 5026 5028 'DiffusionResolveRefsConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 5027 5029 'DiffusionResolveUserQuery' => 'Phobject', ··· 7932 7934 'PhabricatorApplicationTransactionInterface', 7933 7935 'PhabricatorPolicyInterface', 7934 7936 'PhabricatorExtendedPolicyInterface', 7937 + 'PhabricatorConduitResultInterface', 7935 7938 ), 7936 7939 'PhabricatorRepositoryURIIndex' => 'PhabricatorRepositoryDAO', 7937 7940 'PhabricatorRepositoryURINormalizer' => 'Phobject',
+34
src/applications/diffusion/engineextension/DiffusionRepositoryURIsSearchEngineAttachment.php
··· 1 + <?php 2 + 3 + final class DiffusionRepositoryURIsSearchEngineAttachment 4 + extends PhabricatorSearchEngineAttachment { 5 + 6 + public function getAttachmentName() { 7 + return pht('Repository URIs'); 8 + } 9 + 10 + public function getAttachmentDescription() { 11 + return pht('Get a list of associated URIs for each repository.'); 12 + } 13 + 14 + public function willLoadAttachmentData($query, $spec) { 15 + $query->needURIs(true); 16 + } 17 + 18 + public function getAttachmentForObject($object, $data, $spec) { 19 + $uris = array(); 20 + foreach ($object->getURIs() as $uri) { 21 + $uris[] = array( 22 + 'id' => $uri->getID(), 23 + 'type' => phid_get_type($uri->getPHID()), 24 + 'phid' => $uri->getPHID(), 25 + 'fields' => $uri->getFieldValuesForConduit(), 26 + ); 27 + } 28 + 29 + return array( 30 + 'uris' => $uris, 31 + ); 32 + } 33 + 34 + }
+9 -1
src/applications/repository/storage/PhabricatorRepository.php
··· 2454 2454 ->setKey('shortName') 2455 2455 ->setType('string') 2456 2456 ->setDescription(pht('Unique short name, if the repository has one.')), 2457 + id(new PhabricatorConduitSearchFieldSpecification()) 2458 + ->setKey('status') 2459 + ->setType('string') 2460 + ->setDescription(pht('Active or inactive status.')), 2457 2461 ); 2458 2462 } 2459 2463 ··· 2463 2467 'vcs' => $this->getVersionControlSystem(), 2464 2468 'callsign' => $this->getCallsign(), 2465 2469 'shortName' => $this->getRepositorySlug(), 2470 + 'status' => $this->getStatus(), 2466 2471 ); 2467 2472 } 2468 2473 2469 2474 public function getConduitSearchAttachments() { 2470 - return array(); 2475 + return array( 2476 + id(new DiffusionRepositoryURIsSearchEngineAttachment()) 2477 + ->setAttachmentKey('uris'), 2478 + ); 2471 2479 } 2472 2480 2473 2481 }
+85 -1
src/applications/repository/storage/PhabricatorRepositoryURI.php
··· 5 5 implements 6 6 PhabricatorApplicationTransactionInterface, 7 7 PhabricatorPolicyInterface, 8 - PhabricatorExtendedPolicyInterface { 8 + PhabricatorExtendedPolicyInterface, 9 + PhabricatorConduitResultInterface { 9 10 10 11 protected $repositoryPHID; 11 12 protected $uri; ··· 510 511 } 511 512 512 513 return $extended; 514 + } 515 + 516 + 517 + /* -( PhabricatorConduitResultInterface )---------------------------------- */ 518 + 519 + 520 + public function getFieldSpecificationsForConduit() { 521 + return array( 522 + id(new PhabricatorConduitSearchFieldSpecification()) 523 + ->setKey('repositoryPHID') 524 + ->setType('phid') 525 + ->setDescription(pht('The associated repository PHID.')), 526 + id(new PhabricatorConduitSearchFieldSpecification()) 527 + ->setKey('uri') 528 + ->setType('map<string, string>') 529 + ->setDescription(pht('The raw and effective URI.')), 530 + id(new PhabricatorConduitSearchFieldSpecification()) 531 + ->setKey('io') 532 + ->setType('map<string, const>') 533 + ->setDescription( 534 + pht('The raw, default, and effective I/O Type settings.')), 535 + id(new PhabricatorConduitSearchFieldSpecification()) 536 + ->setKey('display') 537 + ->setType('map<string, const>') 538 + ->setDescription( 539 + pht('The raw, default, and effective Display Type settings.')), 540 + id(new PhabricatorConduitSearchFieldSpecification()) 541 + ->setKey('credentialPHID') 542 + ->setType('phid?') 543 + ->setDescription( 544 + pht('The associated credential PHID, if one exists.')), 545 + id(new PhabricatorConduitSearchFieldSpecification()) 546 + ->setKey('disabled') 547 + ->setType('bool') 548 + ->setDescription(pht('True if the URI is disabled.')), 549 + id(new PhabricatorConduitSearchFieldSpecification()) 550 + ->setKey('builtin') 551 + ->setType('map<string, string>') 552 + ->setDescription( 553 + pht('Information about builtin URIs.')), 554 + id(new PhabricatorConduitSearchFieldSpecification()) 555 + ->setKey('dateCreated') 556 + ->setType('int') 557 + ->setDescription( 558 + pht('Epoch timestamp when the object was created.')), 559 + id(new PhabricatorConduitSearchFieldSpecification()) 560 + ->setKey('dateModified') 561 + ->setType('int') 562 + ->setDescription( 563 + pht('Epoch timestamp when the object was last updated.')), 564 + ); 565 + } 566 + 567 + public function getFieldValuesForConduit() { 568 + return array( 569 + 'repositoryPHID' => $this->getRepositoryPHID(), 570 + 'uri' => array( 571 + 'raw' => $this->getURI(), 572 + 'effective' => (string)$this->getDisplayURI(), 573 + ), 574 + 'io' => array( 575 + 'raw' => $this->getIOType(), 576 + 'default' => $this->getDefaultIOType(), 577 + 'effective' => $this->getEffectiveIOType(), 578 + ), 579 + 'display' => array( 580 + 'raw' => $this->getDisplayType(), 581 + 'default' => $this->getDefaultDisplayType(), 582 + 'effective' => $this->getEffectiveDisplayType(), 583 + ), 584 + 'credentialPHID' => $this->getCredentialPHID(), 585 + 'disabled' => (bool)$this->getIsDisabled(), 586 + 'builtin' => array( 587 + 'protocol' => $this->getBuiltinProtocol(), 588 + 'identifier' => $this->getBuiltinIdentifier(), 589 + ), 590 + 'dateCreated' => $this->getDateCreated(), 591 + 'dateModified' => $this->getDateModified(), 592 + ); 593 + } 594 + 595 + public function getConduitSearchAttachments() { 596 + return array(); 513 597 } 514 598 515 599 }