@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

Support new data export infrastructure in Maniphest

Summary: Depends on D18958. Ref T13049. Support the new stuff. There are a couple more fields this needs to strictly improve on the old export, but I'll add them as extensions shortly.

Test Plan: Exported tasks to Excel, saw reasonble-looking data in the export.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13049

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

+114 -1
+2
src/__phutil_library_map__.php
··· 4322 4322 'PhabricatorUIExample' => 'applications/uiexample/examples/PhabricatorUIExample.php', 4323 4323 'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php', 4324 4324 'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php', 4325 + 'PhabricatorURIExportField' => 'infrastructure/export/field/PhabricatorURIExportField.php', 4325 4326 'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php', 4326 4327 'PhabricatorUnifiedDiffsSetting' => 'applications/settings/setting/PhabricatorUnifiedDiffsSetting.php', 4327 4328 'PhabricatorUnitTestContentSource' => 'infrastructure/contentsource/PhabricatorUnitTestContentSource.php', ··· 10023 10024 'PhabricatorUIExample' => 'Phobject', 10024 10025 'PhabricatorUIExampleRenderController' => 'PhabricatorController', 10025 10026 'PhabricatorUIExamplesApplication' => 'PhabricatorApplication', 10027 + 'PhabricatorURIExportField' => 'PhabricatorExportField', 10026 10028 'PhabricatorUSEnglishTranslation' => 'PhutilTranslation', 10027 10029 'PhabricatorUnifiedDiffsSetting' => 'PhabricatorSelectSetting', 10028 10030 'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource',
+1 -1
src/applications/maniphest/application/PhabricatorManiphestApplication.php
··· 50 50 return array( 51 51 '/T(?P<id>[1-9]\d*)' => 'ManiphestTaskDetailController', 52 52 '/maniphest/' => array( 53 - '(?:query/(?P<queryKey>[^/]+)/)?' => 'ManiphestTaskListController', 53 + $this->getQueryRoutePattern() => 'ManiphestTaskListController', 54 54 'report/(?:(?P<view>\w+)/)?' => 'ManiphestReportController', 55 55 $this->getBulkRoutePattern('bulk/') => 'ManiphestBulkEditController', 56 56 'task/' => array(
+107
src/applications/maniphest/query/ManiphestTaskSearchEngine.php
··· 432 432 return $view; 433 433 } 434 434 435 + 436 + protected function newExportFields() { 437 + $fields = array( 438 + id(new PhabricatorStringExportField()) 439 + ->setKey('monogram') 440 + ->setLabel(pht('Monogram')), 441 + id(new PhabricatorPHIDExportField()) 442 + ->setKey('authorPHID') 443 + ->setLabel(pht('Author PHID')), 444 + id(new PhabricatorStringExportField()) 445 + ->setKey('author') 446 + ->setLabel(pht('Author')), 447 + id(new PhabricatorPHIDExportField()) 448 + ->setKey('ownerPHID') 449 + ->setLabel(pht('Owner PHID')), 450 + id(new PhabricatorStringExportField()) 451 + ->setKey('owner') 452 + ->setLabel(pht('Owner')), 453 + id(new PhabricatorStringExportField()) 454 + ->setKey('status') 455 + ->setLabel(pht('Status')), 456 + id(new PhabricatorStringExportField()) 457 + ->setKey('statusName') 458 + ->setLabel(pht('Status Name')), 459 + id(new PhabricatorStringExportField()) 460 + ->setKey('priority') 461 + ->setLabel(pht('Priority')), 462 + id(new PhabricatorStringExportField()) 463 + ->setKey('priorityName') 464 + ->setLabel(pht('Priority Name')), 465 + id(new PhabricatorStringExportField()) 466 + ->setKey('subtype') 467 + ->setLabel('string'), 468 + id(new PhabricatorURIExportField()) 469 + ->setKey('uri') 470 + ->setLabel(pht('URI')), 471 + id(new PhabricatorStringExportField()) 472 + ->setKey('title') 473 + ->setLabel(pht('Title')), 474 + id(new PhabricatorStringExportField()) 475 + ->setKey('description') 476 + ->setLabel(pht('Description')), 477 + ); 478 + 479 + if (ManiphestTaskPoints::getIsEnabled()) { 480 + $fields[] = id(new PhabricatorIntExportField()) 481 + ->setKey('points') 482 + ->setLabel('Points'); 483 + } 484 + 485 + return $fields; 486 + } 487 + 488 + protected function newExportData(array $tasks) { 489 + $viewer = $this->requireViewer(); 490 + 491 + $phids = array(); 492 + foreach ($tasks as $task) { 493 + $phids[] = $task->getAuthorPHID(); 494 + $phids[] = $task->getOwnerPHID(); 495 + } 496 + $handles = $viewer->loadHandles($phids); 497 + 498 + $export = array(); 499 + foreach ($tasks as $task) { 500 + 501 + $author_phid = $task->getAuthorPHID(); 502 + if ($author_phid) { 503 + $author_name = $handles[$author_phid]->getName(); 504 + } else { 505 + $author_name = null; 506 + } 507 + 508 + $owner_phid = $task->getOwnerPHID(); 509 + if ($owner_phid) { 510 + $owner_name = $handles[$owner_phid]->getName(); 511 + } else { 512 + $owner_name = null; 513 + } 514 + 515 + $status_value = $task->getStatus(); 516 + $status_name = ManiphestTaskStatus::getTaskStatusName($status_value); 517 + 518 + $priority_value = $task->getPriority(); 519 + $priority_name = ManiphestTaskPriority::getTaskPriorityName( 520 + $priority_value); 521 + 522 + $export[] = array( 523 + 'monogram' => $task->getMonogram(), 524 + 'authorPHID' => $author_phid, 525 + 'author' => $author_name, 526 + 'ownerPHID' => $owner_phid, 527 + 'owner' => $owner_name, 528 + 'status' => $status_value, 529 + 'statusName' => $status_name, 530 + 'priority' => $priority_value, 531 + 'priorityName' => $priority_name, 532 + 'points' => $task->getPoints(), 533 + 'subtype' => $task->getSubtype(), 534 + 'title' => $task->getTitle(), 535 + 'uri' => PhabricatorEnv::getProductionURI($task->getURI()), 536 + 'description' => $task->getDescription(), 537 + ); 538 + } 539 + 540 + return $export; 541 + } 435 542 }
+4
src/infrastructure/export/field/PhabricatorURIExportField.php
··· 1 + <?php 2 + 3 + final class PhabricatorURIExportField 4 + extends PhabricatorExportField {}