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

For now, hard limit task graph at 100 nodes

Summary:
Ref T4788. One install has some particularly impressive task graphs which are thousands of nodes large.

The current graph is pretty broken in these cases. For now, just render a "too big to show" message. In the future, I'd plan to finesse this (e.g., show parents/children, show links to parents/children, etc).

Test Plan:
- Viewed a normal task.
- Set limit to 3, viewed a task with graph size 6, saw an error message.
- Viewed a revision stack graph (unaffected).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4788

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

+38 -1
+14 -1
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 87 87 ->addPropertySection(pht('Description'), $description) 88 88 ->addPropertySection(pht('Details'), $details); 89 89 90 + $graph_limit = 100; 90 91 $task_graph = id(new ManiphestTaskGraph()) 91 92 ->setViewer($viewer) 92 93 ->setSeedPHID($task->getPHID()) 94 + ->setLimit($graph_limit) 93 95 ->loadGraph(); 94 96 if (!$task_graph->isEmpty()) { 95 - $graph_table = $task_graph->newGraphTable(); 97 + if ($task_graph->isOverLimit()) { 98 + $message = pht( 99 + 'Task graph too large to display (this task is connected to '. 100 + 'more than %s other tasks).', 101 + $graph_limit); 102 + $message = phutil_tag('em', array(), $message); 103 + $graph_table = id(new PHUIPropertyListView()) 104 + ->addTextContent($message); 105 + } else { 106 + $graph_table = $task_graph->newGraphTable(); 107 + } 108 + 96 109 $view->addPropertySection(pht('Task Graph'), $graph_table); 97 110 } 98 111
+24
src/infrastructure/graph/PhabricatorObjectGraph.php
··· 9 9 private $seedPHID; 10 10 private $objects; 11 11 private $loadEntireGraph = false; 12 + private $limit; 12 13 13 14 public function setViewer(PhabricatorUser $viewer) { 14 15 $this->viewer = $viewer; ··· 23 24 return $this->viewer; 24 25 } 25 26 27 + public function setLimit($limit) { 28 + $this->limit = $limit; 29 + return $this; 30 + } 31 + 32 + public function getLimit() { 33 + return $this->limit; 34 + } 35 + 26 36 abstract protected function getEdgeTypes(); 27 37 abstract protected function getParentEdgeType(); 28 38 abstract protected function newQuery(); ··· 44 54 return (count($this->getNodes()) <= 2); 45 55 } 46 56 57 + final public function isOverLimit() { 58 + $limit = $this->getLimit(); 59 + 60 + if (!$limit) { 61 + return false; 62 + } 63 + 64 + return (count($this->edgeReach) > $limit); 65 + } 66 + 47 67 final public function getEdges($type) { 48 68 $edges = idx($this->edges, $type, array()); 49 69 ··· 72 92 } 73 93 74 94 final protected function loadEdges(array $nodes) { 95 + if ($this->isOverLimit()) { 96 + return array_fill_keys($nodes, array()); 97 + } 98 + 75 99 $edge_types = $this->getEdgeTypes(); 76 100 77 101 $query = id(new PhabricatorEdgeQuery())