Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15426939
D18960.id45460.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
19 KB
Referenced Files
None
Subscribers
None
D18960.id45460.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
@@ -3130,9 +3130,11 @@
'PhabricatorLipsumManagementWorkflow' => 'applications/lipsum/management/PhabricatorLipsumManagementWorkflow.php',
'PhabricatorLipsumMondrianArtist' => 'applications/lipsum/image/PhabricatorLipsumMondrianArtist.php',
'PhabricatorLiskDAO' => 'infrastructure/storage/lisk/PhabricatorLiskDAO.php',
+ 'PhabricatorLiskExportEngineExtension' => 'infrastructure/export/engine/PhabricatorLiskExportEngineExtension.php',
'PhabricatorLiskFulltextEngineExtension' => 'applications/search/engineextension/PhabricatorLiskFulltextEngineExtension.php',
'PhabricatorLiskSearchEngineExtension' => 'applications/search/engineextension/PhabricatorLiskSearchEngineExtension.php',
'PhabricatorLiskSerializer' => 'infrastructure/storage/lisk/PhabricatorLiskSerializer.php',
+ 'PhabricatorListExportField' => 'infrastructure/export/field/PhabricatorListExportField.php',
'PhabricatorLocalDiskFileStorageEngine' => 'applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php',
'PhabricatorLocalTimeTestCase' => 'view/__tests__/PhabricatorLocalTimeTestCase.php',
'PhabricatorLocaleScopeGuard' => 'infrastructure/internationalization/scope/PhabricatorLocaleScopeGuard.php',
@@ -3431,6 +3433,7 @@
'PhabricatorPHIDInterface' => 'applications/phid/interface/PhabricatorPHIDInterface.php',
'PhabricatorPHIDListEditField' => 'applications/transactions/editfield/PhabricatorPHIDListEditField.php',
'PhabricatorPHIDListEditType' => 'applications/transactions/edittype/PhabricatorPHIDListEditType.php',
+ 'PhabricatorPHIDListExportField' => 'infrastructure/export/field/PhabricatorPHIDListExportField.php',
'PhabricatorPHIDResolver' => 'applications/phid/resolver/PhabricatorPHIDResolver.php',
'PhabricatorPHIDType' => 'applications/phid/type/PhabricatorPHIDType.php',
'PhabricatorPHIDTypeTestCase' => 'applications/phid/type/__tests__/PhabricatorPHIDTypeTestCase.php',
@@ -3839,6 +3842,7 @@
'PhabricatorProjectsCurtainExtension' => 'applications/project/engineextension/PhabricatorProjectsCurtainExtension.php',
'PhabricatorProjectsEditEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php',
'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php',
+ 'PhabricatorProjectsExportEngineExtension' => 'infrastructure/export/engine/PhabricatorProjectsExportEngineExtension.php',
'PhabricatorProjectsFulltextEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsFulltextEngineExtension.php',
'PhabricatorProjectsMembersSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsMembersSearchEngineAttachment.php',
'PhabricatorProjectsMembershipIndexEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php',
@@ -4130,6 +4134,7 @@
'PhabricatorSpacesController' => 'applications/spaces/controller/PhabricatorSpacesController.php',
'PhabricatorSpacesDAO' => 'applications/spaces/storage/PhabricatorSpacesDAO.php',
'PhabricatorSpacesEditController' => 'applications/spaces/controller/PhabricatorSpacesEditController.php',
+ 'PhabricatorSpacesExportEngineExtension' => 'infrastructure/export/engine/PhabricatorSpacesExportEngineExtension.php',
'PhabricatorSpacesInterface' => 'applications/spaces/interface/PhabricatorSpacesInterface.php',
'PhabricatorSpacesListController' => 'applications/spaces/controller/PhabricatorSpacesListController.php',
'PhabricatorSpacesNamespace' => 'applications/spaces/storage/PhabricatorSpacesNamespace.php',
@@ -4196,6 +4201,7 @@
'PhabricatorStringExportField' => 'infrastructure/export/field/PhabricatorStringExportField.php',
'PhabricatorStringListConfigType' => 'applications/config/type/PhabricatorStringListConfigType.php',
'PhabricatorStringListEditField' => 'applications/transactions/editfield/PhabricatorStringListEditField.php',
+ 'PhabricatorStringListExportField' => 'infrastructure/export/field/PhabricatorStringListExportField.php',
'PhabricatorStringSetting' => 'applications/settings/setting/PhabricatorStringSetting.php',
'PhabricatorSubmitEditField' => 'applications/transactions/editfield/PhabricatorSubmitEditField.php',
'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php',
@@ -4210,6 +4216,7 @@
'PhabricatorSubscriptionsEditController' => 'applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php',
'PhabricatorSubscriptionsEditEngineExtension' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsEditEngineExtension.php',
'PhabricatorSubscriptionsEditor' => 'applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php',
+ 'PhabricatorSubscriptionsExportEngineExtension' => 'infrastructure/export/engine/PhabricatorSubscriptionsExportEngineExtension.php',
'PhabricatorSubscriptionsFulltextEngineExtension' => 'applications/subscriptions/engineextension/PhabricatorSubscriptionsFulltextEngineExtension.php',
'PhabricatorSubscriptionsHeraldAction' => 'applications/subscriptions/herald/PhabricatorSubscriptionsHeraldAction.php',
'PhabricatorSubscriptionsListController' => 'applications/subscriptions/controller/PhabricatorSubscriptionsListController.php',
@@ -8608,9 +8615,11 @@
'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist',
'PhabricatorLiskDAO' => 'LiskDAO',
+ 'PhabricatorLiskExportEngineExtension' => 'PhabricatorExportEngineExtension',
'PhabricatorLiskFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorLiskSearchEngineExtension' => 'PhabricatorSearchEngineExtension',
'PhabricatorLiskSerializer' => 'Phobject',
+ 'PhabricatorListExportField' => 'PhabricatorExportField',
'PhabricatorLocalDiskFileStorageEngine' => 'PhabricatorFileStorageEngine',
'PhabricatorLocalTimeTestCase' => 'PhabricatorTestCase',
'PhabricatorLocaleScopeGuard' => 'Phobject',
@@ -8948,6 +8957,7 @@
'PhabricatorPHIDExportField' => 'PhabricatorExportField',
'PhabricatorPHIDListEditField' => 'PhabricatorEditField',
'PhabricatorPHIDListEditType' => 'PhabricatorEditType',
+ 'PhabricatorPHIDListExportField' => 'PhabricatorListExportField',
'PhabricatorPHIDResolver' => 'Phobject',
'PhabricatorPHIDType' => 'Phobject',
'PhabricatorPHIDTypeTestCase' => 'PhutilTestCase',
@@ -9448,6 +9458,7 @@
'PhabricatorProjectsCurtainExtension' => 'PHUICurtainExtension',
'PhabricatorProjectsEditEngineExtension' => 'PhabricatorEditEngineExtension',
'PhabricatorProjectsEditField' => 'PhabricatorTokenizerEditField',
+ 'PhabricatorProjectsExportEngineExtension' => 'PhabricatorExportEngineExtension',
'PhabricatorProjectsFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorProjectsMembersSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'PhabricatorProjectsMembershipIndexEngineExtension' => 'PhabricatorIndexEngineExtension',
@@ -9815,6 +9826,7 @@
'PhabricatorSpacesController' => 'PhabricatorController',
'PhabricatorSpacesDAO' => 'PhabricatorLiskDAO',
'PhabricatorSpacesEditController' => 'PhabricatorSpacesController',
+ 'PhabricatorSpacesExportEngineExtension' => 'PhabricatorExportEngineExtension',
'PhabricatorSpacesInterface' => 'PhabricatorPHIDInterface',
'PhabricatorSpacesListController' => 'PhabricatorSpacesController',
'PhabricatorSpacesNamespace' => array(
@@ -9888,6 +9900,7 @@
'PhabricatorStringExportField' => 'PhabricatorExportField',
'PhabricatorStringListConfigType' => 'PhabricatorTextListConfigType',
'PhabricatorStringListEditField' => 'PhabricatorEditField',
+ 'PhabricatorStringListExportField' => 'PhabricatorListExportField',
'PhabricatorStringSetting' => 'PhabricatorSetting',
'PhabricatorSubmitEditField' => 'PhabricatorEditField',
'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType',
@@ -9901,6 +9914,7 @@
'PhabricatorSubscriptionsEditController' => 'PhabricatorController',
'PhabricatorSubscriptionsEditEngineExtension' => 'PhabricatorEditEngineExtension',
'PhabricatorSubscriptionsEditor' => 'PhabricatorEditor',
+ 'PhabricatorSubscriptionsExportEngineExtension' => 'PhabricatorExportEngineExtension',
'PhabricatorSubscriptionsFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
'PhabricatorSubscriptionsHeraldAction' => 'HeraldAction',
'PhabricatorSubscriptionsListController' => 'PhabricatorController',
diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
--- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
+++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php
@@ -464,7 +464,7 @@
->setLabel(pht('Priority Name')),
id(new PhabricatorStringExportField())
->setKey('subtype')
- ->setLabel('string'),
+ ->setLabel('Subtype'),
id(new PhabricatorURIExportField())
->setKey('uri')
->setLabel(pht('URI')),
diff --git a/src/applications/people/query/PhabricatorPeopleSearchEngine.php b/src/applications/people/query/PhabricatorPeopleSearchEngine.php
--- a/src/applications/people/query/PhabricatorPeopleSearchEngine.php
+++ b/src/applications/people/query/PhabricatorPeopleSearchEngine.php
@@ -328,9 +328,6 @@
id(new PhabricatorStringExportField())
->setKey('realName')
->setLabel(pht('Real Name')),
- id(new PhabricatorEpochExportField())
- ->setKey('created')
- ->setLabel(pht('Date Created')),
);
}
@@ -342,7 +339,6 @@
$export[] = array(
'username' => $user->getUsername(),
'realName' => $user->getRealName(),
- 'created' => $user->getDateCreated(),
);
}
diff --git a/src/infrastructure/export/engine/PhabricatorLiskExportEngineExtension.php b/src/infrastructure/export/engine/PhabricatorLiskExportEngineExtension.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/engine/PhabricatorLiskExportEngineExtension.php
@@ -0,0 +1,42 @@
+<?php
+
+final class PhabricatorLiskExportEngineExtension
+ extends PhabricatorExportEngineExtension {
+
+ const EXTENSIONKEY = 'lisk';
+
+ public function supportsObject($object) {
+ if (!($object instanceof LiskDAO)) {
+ return false;
+ }
+
+ if (!$object->getConfigOption(LiskDAO::CONFIG_TIMESTAMPS)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public function newExportFields() {
+ return array(
+ id(new PhabricatorEpochExportField())
+ ->setKey('dateCreated')
+ ->setLabel(pht('Created')),
+ id(new PhabricatorEpochExportField())
+ ->setKey('dateModified')
+ ->setLabel(pht('Modified')),
+ );
+ }
+
+ public function newExportData(array $objects) {
+ $map = array();
+ foreach ($objects as $object) {
+ $map[] = array(
+ 'dateCreated' => $object->getDateCreated(),
+ 'dateModified' => $object->getDateModified(),
+ );
+ }
+ return $map;
+ }
+
+}
diff --git a/src/infrastructure/export/engine/PhabricatorProjectsExportEngineExtension.php b/src/infrastructure/export/engine/PhabricatorProjectsExportEngineExtension.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/engine/PhabricatorProjectsExportEngineExtension.php
@@ -0,0 +1,60 @@
+<?php
+
+final class PhabricatorProjectsExportEngineExtension
+ extends PhabricatorExportEngineExtension {
+
+ const EXTENSIONKEY = 'projects';
+
+ public function supportsObject($object) {
+ return ($object instanceof PhabricatorProjectInterface);
+ }
+
+ public function newExportFields() {
+ return array(
+ id(new PhabricatorPHIDListExportField())
+ ->setKey('tagPHIDs')
+ ->setLabel(pht('Tag PHIDs')),
+ id(new PhabricatorStringListExportField())
+ ->setKey('tags')
+ ->setLabel(pht('Tags')),
+ );
+ }
+
+ public function newExportData(array $objects) {
+ $viewer = $this->getViewer();
+
+ $object_phids = mpull($objects, 'getPHID');
+
+ $projects_query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs($object_phids)
+ ->withEdgeTypes(
+ array(
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
+ ));
+ $projects_query->execute();
+
+ $handles = $viewer->loadHandles($projects_query->getDestinationPHIDs());
+
+ $map = array();
+ foreach ($objects as $object) {
+ $object_phid = $object->getPHID();
+
+ $project_phids = $projects_query->getDestinationPHIDs(
+ array($object_phid),
+ array(PhabricatorProjectObjectHasProjectEdgeType::EDGECONST));
+
+ $handle_list = $handles->newSublist($project_phids);
+ $handle_list = iterator_to_array($handle_list);
+ $handle_names = mpull($handle_list, 'getName');
+ $handle_names = array_values($handle_names);
+
+ $map[] = array(
+ 'tagPHIDs' => $project_phids,
+ 'tags' => $handle_names,
+ );
+ }
+
+ return $map;
+ }
+
+}
diff --git a/src/infrastructure/export/engine/PhabricatorSpacesExportEngineExtension.php b/src/infrastructure/export/engine/PhabricatorSpacesExportEngineExtension.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/engine/PhabricatorSpacesExportEngineExtension.php
@@ -0,0 +1,53 @@
+<?php
+
+final class PhabricatorSpacesExportEngineExtension
+ extends PhabricatorExportEngineExtension {
+
+ const EXTENSIONKEY = 'spaces';
+
+ public function supportsObject($object) {
+ $viewer = $this->getViewer();
+
+ if (!PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
+ return false;
+ }
+
+ return ($object instanceof PhabricatorSpacesInterface);
+ }
+
+ public function newExportFields() {
+ return array(
+ id(new PhabricatorPHIDExportField())
+ ->setKey('spacePHID')
+ ->setLabel(pht('Space PHID')),
+ id(new PhabricatorStringExportField())
+ ->setKey('space')
+ ->setLabel(pht('Space')),
+ );
+ }
+
+ public function newExportData(array $objects) {
+ $viewer = $this->getViewer();
+
+ $space_phids = array();
+ foreach ($objects as $object) {
+ $space_phids[] = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
+ $object);
+ }
+ $handles = $viewer->loadHandles($space_phids);
+
+ $map = array();
+ foreach ($objects as $object) {
+ $space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
+ $object);
+
+ $map[] = array(
+ 'spacePHID' => $space_phid,
+ 'space' => $handles[$space_phid]->getName(),
+ );
+ }
+
+ return $map;
+ }
+
+}
diff --git a/src/infrastructure/export/engine/PhabricatorSubscriptionsExportEngineExtension.php b/src/infrastructure/export/engine/PhabricatorSubscriptionsExportEngineExtension.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/engine/PhabricatorSubscriptionsExportEngineExtension.php
@@ -0,0 +1,60 @@
+<?php
+
+final class PhabricatorSubscriptionsExportEngineExtension
+ extends PhabricatorExportEngineExtension {
+
+ const EXTENSIONKEY = 'subscriptions';
+
+ public function supportsObject($object) {
+ return ($object instanceof PhabricatorSubscribableInterface);
+ }
+
+ public function newExportFields() {
+ return array(
+ id(new PhabricatorPHIDListExportField())
+ ->setKey('subscriberPHIDs')
+ ->setLabel(pht('Subscriber PHIDs')),
+ id(new PhabricatorStringListExportField())
+ ->setKey('subscribers')
+ ->setLabel(pht('Subscribers')),
+ );
+ }
+
+ public function newExportData(array $objects) {
+ $viewer = $this->getViewer();
+
+ $object_phids = mpull($objects, 'getPHID');
+
+ $projects_query = id(new PhabricatorEdgeQuery())
+ ->withSourcePHIDs($object_phids)
+ ->withEdgeTypes(
+ array(
+ PhabricatorObjectHasSubscriberEdgeType::EDGECONST,
+ ));
+ $projects_query->execute();
+
+ $handles = $viewer->loadHandles($projects_query->getDestinationPHIDs());
+
+ $map = array();
+ foreach ($objects as $object) {
+ $object_phid = $object->getPHID();
+
+ $project_phids = $projects_query->getDestinationPHIDs(
+ array($object_phid),
+ array(PhabricatorObjectHasSubscriberEdgeType::EDGECONST));
+
+ $handle_list = $handles->newSublist($project_phids);
+ $handle_list = iterator_to_array($handle_list);
+ $handle_names = mpull($handle_list, 'getName');
+ $handle_names = array_values($handle_names);
+
+ $map[] = array(
+ 'subscriberPHIDs' => $project_phids,
+ 'subscribers' => $handle_names,
+ );
+ }
+
+ return $map;
+ }
+
+}
diff --git a/src/infrastructure/export/field/PhabricatorExportField.php b/src/infrastructure/export/field/PhabricatorExportField.php
--- a/src/infrastructure/export/field/PhabricatorExportField.php
+++ b/src/infrastructure/export/field/PhabricatorExportField.php
@@ -25,7 +25,13 @@
}
public function getTextValue($value) {
- return (string)$this->getNaturalValue($value);
+ $natural_value = $this->getNaturalValue($value);
+
+ if ($natural_value === null) {
+ return null;
+ }
+
+ return (string)$natural_value;
}
public function getNaturalValue($value) {
diff --git a/src/infrastructure/export/field/PhabricatorListExportField.php b/src/infrastructure/export/field/PhabricatorListExportField.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/field/PhabricatorListExportField.php
@@ -0,0 +1,10 @@
+<?php
+
+abstract class PhabricatorListExportField
+ extends PhabricatorExportField {
+
+ public function getTextValue($value) {
+ return implode("\n", $value);
+ }
+
+}
diff --git a/src/infrastructure/export/field/PhabricatorPHIDListExportField.php b/src/infrastructure/export/field/PhabricatorPHIDListExportField.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/field/PhabricatorPHIDListExportField.php
@@ -0,0 +1,10 @@
+<?php
+
+final class PhabricatorPHIDListExportField
+ extends PhabricatorListExportField {
+
+ public function getCharacterWidth() {
+ return 32;
+ }
+
+}
diff --git a/src/infrastructure/export/field/PhabricatorStringExportField.php b/src/infrastructure/export/field/PhabricatorStringExportField.php
--- a/src/infrastructure/export/field/PhabricatorStringExportField.php
+++ b/src/infrastructure/export/field/PhabricatorStringExportField.php
@@ -1,4 +1,18 @@
<?php
final class PhabricatorStringExportField
- extends PhabricatorExportField {}
+ extends PhabricatorExportField {
+
+ public function getNaturalValue($value) {
+ if ($value === null) {
+ return $value;
+ }
+
+ if (!strlen($value)) {
+ return null;
+ }
+
+ return (string)$value;
+ }
+
+}
diff --git a/src/infrastructure/export/field/PhabricatorStringListExportField.php b/src/infrastructure/export/field/PhabricatorStringListExportField.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/export/field/PhabricatorStringListExportField.php
@@ -0,0 +1,4 @@
+<?php
+
+final class PhabricatorStringListExportField
+ extends PhabricatorListExportField {}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 24, 11:45 AM (3 d, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7720169
Default Alt Text
D18960.id45460.diff (19 KB)
Attached To
Mode
D18960: Implement common infrastructure fields as export extensions
Attached
Detach File
Event Timeline
Log In to Comment