Page MenuHomePhabricator
Paste P63254

T119376
ActivePublic

Authored by Aklapper on May 27 2024, 6:11 AM.
Tags
None
Referenced Files
F54432098: T119376
May 27 2024, 6:11 AM
Subscribers
None
diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php
index 012d6d136b..fc72ae7f05 100644
--- a/src/applications/maniphest/controller/ManiphestReportController.php
+++ b/src/applications/maniphest/controller/ManiphestReportController.php
@@ -174,6 +174,56 @@ final class ManiphestReportController extends ManiphestController {
// Merge the synthetic rows into the real transactions.
$data = array_merge($create_rows, $data);
+
+/* WMF T119376 BEGIN - handle tasks imported from BZ + RT w/o transactions */
+ if ($project_phid) {
+ $wmf_joins = qsprintf(
+ $conn,
+ 'JOIN %T p ON p.src = t.phid AND p.type = %d AND p.dst = %s',
+ PhabricatorEdgeConfig::TABLE_NAME_EDGE,
+ PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
+ $project_phid);
+ } else {
+ $wmf_joins = qsprintf($conn, '');
+ }
+
+ $wmf_legacy_rows_open = queryfx_all(
+ $conn,
+ 'SELECT t.dateCreated
+ FROM %T t %Q
+ WHERE ((t.id > 2000 AND t.id < 75683)
+ OR (t.id > 78842 AND t.id < 84828))',
+ id(new ManiphestTask())->getTableName(),
+ $wmf_joins);
+ foreach ($wmf_legacy_rows_open as $key => $wmf_legacy_row_open) {
+ $wmf_legacy_rows_open[$key] = array(
+ 'transactionType' => 'status',
+ 'oldValue' => null,
+ 'newValue' => $default_status, // open
+ 'dateCreated' => $wmf_legacy_row_open['dateCreated'],
+ );
+ }
+ $wmf_legacy_rows_closed = queryfx_all(
+ $conn,
+ 'SELECT t.closedEpoch
+ FROM %T t %Q
+ WHERE ((t.id > 2000 AND t.id < 75683)
+ OR (t.id > 78842 AND t.id < 84828))
+ AND (t.closedEpoch = 1418860800 OR t.closedEpoch = 1416614400)',
+ id(new ManiphestTask())->getTableName(),
+ $wmf_joins);
+ foreach ($wmf_legacy_rows_closed as $key => $wmf_legacy_row_closed) {
+ $wmf_legacy_rows_closed[$key] = array(
+ 'transactionType' => 'status',
+ 'oldValue' => $default_status, //open
+ 'newValue' => 'resolved',
+ 'dateCreated' => $wmf_legacy_row_closed['closedEpoch'],
+ );
+ }
+ $data = array_merge($wmf_legacy_rows_open, $data);
+ $data = array_merge($wmf_legacy_rows_closed, $data);
+/* WMF T119376 END - handle tasks imported from BZ + RT w/o transactions */
+
$data = array_values($data);
$data = isort($data, 'dateCreated');