From 058d2489e7a3c1f2f4badea5e095dad5ad714f8b Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 16 Oct 2020 13:38:17 -0700 Subject: [PATCH] Expose the "file attached to object" and "object attached to file" edges via "edge.search" Summary: See PHI1901. An install would like improved support for identifying files related to an object (like a task or revision) for retention/archival/backup/migration/snapshotting purposes. The "attachment" edge is not really user-level: it just means "if you can see the object, that allows you to see the file". This set includes files that users may not think of as "attached", like thumbnails and internal objects which are attached for technical reasons. However, this is generally an appropriate relationship to expose for retention purposes. Test Plan: Used "edge.search" to find files attached to a revision and objects attached to a file. Differential Revision: https://secure.phabricator.com/D21480 --- .../files/edge/PhabricatorFileHasObjectEdgeType.php | 12 ++++++++++++ .../edges/PhabricatorObjectHasFileEdgeType.php | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/applications/files/edge/PhabricatorFileHasObjectEdgeType.php b/src/applications/files/edge/PhabricatorFileHasObjectEdgeType.php index 50ff9ceafa..c4a3c2af87 100644 --- a/src/applications/files/edge/PhabricatorFileHasObjectEdgeType.php +++ b/src/applications/files/edge/PhabricatorFileHasObjectEdgeType.php @@ -12,4 +12,16 @@ final class PhabricatorFileHasObjectEdgeType extends PhabricatorEdgeType { return true; } + public function getConduitKey() { + return 'file.attached-objects'; + } + + public function getConduitName() { + return pht('File Has Object'); + } + + public function getConduitDescription() { + return pht('The source file is attached to the destination object.'); + } + } diff --git a/src/applications/transactions/edges/PhabricatorObjectHasFileEdgeType.php b/src/applications/transactions/edges/PhabricatorObjectHasFileEdgeType.php index 864665e45b..6ed89ff91b 100644 --- a/src/applications/transactions/edges/PhabricatorObjectHasFileEdgeType.php +++ b/src/applications/transactions/edges/PhabricatorObjectHasFileEdgeType.php @@ -12,6 +12,18 @@ final class PhabricatorObjectHasFileEdgeType extends PhabricatorEdgeType { return true; } + public function getConduitKey() { + return 'object.attached-files'; + } + + public function getConduitName() { + return pht('Object Has Files'); + } + + public function getConduitDescription() { + return pht('The source object is associated with the destination file.'); + } + public function getTransactionAddString( $actor, $add_count,