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

Add a "content" attachment for Pastes for Conduit API

Summary: Ref T9964. Builds on D14772. Allows callers to get the raw content of pastes as an attachment.

Test Plan:
- Read docs.
- Executed attachment query.
- Saw raw paste content.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

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

+55 -4
+2
src/__phutil_library_map__.php
··· 2643 2643 'PhabricatorPasteApplication' => 'applications/paste/application/PhabricatorPasteApplication.php', 2644 2644 'PhabricatorPasteArchiveController' => 'applications/paste/controller/PhabricatorPasteArchiveController.php', 2645 2645 'PhabricatorPasteConfigOptions' => 'applications/paste/config/PhabricatorPasteConfigOptions.php', 2646 + 'PhabricatorPasteContentSearchEngineAttachment' => 'applications/paste/engineextension/PhabricatorPasteContentSearchEngineAttachment.php', 2646 2647 'PhabricatorPasteController' => 'applications/paste/controller/PhabricatorPasteController.php', 2647 2648 'PhabricatorPasteDAO' => 'applications/paste/storage/PhabricatorPasteDAO.php', 2648 2649 'PhabricatorPasteEditController' => 'applications/paste/controller/PhabricatorPasteEditController.php', ··· 6883 6884 'PhabricatorPasteApplication' => 'PhabricatorApplication', 6884 6885 'PhabricatorPasteArchiveController' => 'PhabricatorPasteController', 6885 6886 'PhabricatorPasteConfigOptions' => 'PhabricatorApplicationConfigOptions', 6887 + 'PhabricatorPasteContentSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 6886 6888 'PhabricatorPasteController' => 'PhabricatorController', 6887 6889 'PhabricatorPasteDAO' => 'PhabricatorLiskDAO', 6888 6890 'PhabricatorPasteEditController' => 'PhabricatorPasteController',
+5
src/applications/conduit/interface/PhabricatorConduitResultInterface.php
··· 5 5 6 6 public function getFieldSpecificationsForConduit(); 7 7 public function getFieldValuesForConduit(); 8 + public function getConduitSearchAttachments(); 8 9 9 10 } 10 11 ··· 26 27 return array( 27 28 'name' => $this->getName(), 28 29 ); 30 + } 31 + 32 + public function getConduitSearchAttachments() { 33 + return array(); 29 34 } 30 35 31 36 */
+4
src/applications/conduit/query/ConduitResultSearchEngineExtension.php
··· 29 29 return $object->getFieldValuesForConduit(); 30 30 } 31 31 32 + public function getSearchAttachments($object) { 33 + return $object->getConduitSearchAttachments(); 34 + } 35 + 32 36 }
+4
src/applications/maniphest/storage/ManiphestTask.php
··· 437 437 ); 438 438 } 439 439 440 + public function getConduitSearchAttachments() { 441 + return array(); 442 + } 443 + 440 444 }
+4
src/applications/owners/storage/PhabricatorOwnersPackage.php
··· 395 395 ); 396 396 } 397 397 398 + public function getConduitSearchAttachments() { 399 + return array(); 400 + } 401 + 398 402 }
+24
src/applications/paste/engineextension/PhabricatorPasteContentSearchEngineAttachment.php
··· 1 + <?php 2 + 3 + final class PhabricatorPasteContentSearchEngineAttachment 4 + extends PhabricatorSearchEngineAttachment { 5 + 6 + public function getAttachmentName() { 7 + return pht('Paste Content'); 8 + } 9 + 10 + public function getAttachmentDescription() { 11 + return pht('Get the full content for each paste.'); 12 + } 13 + 14 + public function willLoadAttachmentData($query, $spec) { 15 + $query->needRawContent(true); 16 + } 17 + 18 + public function getAttachmentForObject($object, $data, $spec) { 19 + return array( 20 + 'data' => $object->getRawContent(), 21 + ); 22 + } 23 + 24 + }
+7
src/applications/paste/storage/PhabricatorPaste.php
··· 285 285 ); 286 286 } 287 287 288 + public function getConduitSearchAttachments() { 289 + return array( 290 + id(new PhabricatorPasteContentSearchEngineAttachment()) 291 + ->setAttachmentKey('content'), 292 + ); 293 + } 294 + 288 295 }
+1 -1
src/applications/project/engineextension/PhabricatorProjectsSearchEngineExtension.php
··· 49 49 return $fields; 50 50 } 51 51 52 - public function getSearchAttachments() { 52 + public function getSearchAttachments($object) { 53 53 return array( 54 54 id(new PhabricatorProjectsSearchEngineAttachment()) 55 55 ->setAttachmentKey('projects'),
+2 -1
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 1319 1319 1320 1320 public function getConduitSearchAttachments() { 1321 1321 $extensions = $this->getEngineExtensions(); 1322 + $object = $this->newResultObject(); 1322 1323 1323 1324 $attachments = array(); 1324 1325 foreach ($extensions as $extension) { 1325 - $extension_attachments = $extension->getSearchAttachments(); 1326 + $extension_attachments = $extension->getSearchAttachments($object); 1326 1327 foreach ($extension_attachments as $attachment) { 1327 1328 $attachment_key = $attachment->getAttachmentKey(); 1328 1329 if (isset($attachments[$attachment_key])) {
+1 -1
src/applications/search/engineextension/PhabricatorSearchEngineExtension.php
··· 40 40 return array(); 41 41 } 42 42 43 - public function getSearchAttachments() { 43 + public function getSearchAttachments($object) { 44 44 return array(); 45 45 } 46 46
+1 -1
src/applications/subscriptions/engineextension/PhabricatorSubscriptionsSearchEngineExtension.php
··· 50 50 return $fields; 51 51 } 52 52 53 - public function getSearchAttachments() { 53 + public function getSearchAttachments($object) { 54 54 return array( 55 55 id(new PhabricatorSubscriptionsSearchEngineAttachment()) 56 56 ->setAttachmentKey('subscribers'),