@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
at recaptime-dev/main 121 lines 3.1 kB view raw
1<?php 2 3final class PhabricatorConfigIssueListController 4 extends PhabricatorConfigController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $viewer = $request->getViewer(); 8 9 $engine = new PhabricatorSetupEngine(); 10 $response = $engine->execute(); 11 if ($response) { 12 return $response; 13 } 14 $issues = $engine->getIssues(); 15 16 $important = $this->buildIssueList( 17 $issues, 18 PhabricatorSetupCheck::GROUP_IMPORTANT, 19 'fa-warning'); 20 $php = $this->buildIssueList( 21 $issues, 22 PhabricatorSetupCheck::GROUP_PHP, 23 'fa-code'); 24 $mysql = $this->buildIssueList( 25 $issues, 26 PhabricatorSetupCheck::GROUP_MYSQL, 27 'fa-database'); 28 $other = $this->buildIssueList( 29 $issues, 30 PhabricatorSetupCheck::GROUP_OTHER, 31 'fa-question-circle'); 32 33 $title = pht('Setup Issues'); 34 35 if (!$issues) { 36 $issue_list = id(new PHUIInfoView()) 37 ->setTitle(pht('No Issues')) 38 ->appendChild( 39 pht('Your install has no current setup issues to resolve.')) 40 ->setSeverity(PHUIInfoView::SEVERITY_NOTICE); 41 } else { 42 $issue_list = array( 43 $important, 44 $php, 45 $mysql, 46 $other, 47 ); 48 49 $issue_list = $this->buildConfigBoxView( 50 pht('Unresolved Setup Issues'), 51 $issue_list); 52 } 53 54 $crumbs = $this->buildApplicationCrumbs() 55 ->addTextCrumb($title) 56 ->setBorder(true); 57 58 $launcher_view = id(new PHUILauncherView()) 59 ->appendChild($issue_list); 60 61 $content = id(new PHUITwoColumnView()) 62 ->setFooter($launcher_view); 63 64 return $this->newPage() 65 ->setTitle($title) 66 ->setCrumbs($crumbs) 67 ->appendChild($content); 68 } 69 70 /** 71 * @param array<PhabricatorSetupIssue> $issues 72 * @param string $group 73 * @param string $fonticon FontAwesome icon name 74 */ 75 private function buildIssueList(array $issues, $group, $fonticon) { 76 assert_instances_of($issues, PhabricatorSetupIssue::class); 77 $list = new PHUIObjectItemListView(); 78 $list->setBig(true); 79 $ignored_items = array(); 80 $items = 0; 81 82 foreach ($issues as $issue) { 83 if ($issue->getGroup() != $group) { 84 continue; 85 } 86 87 $items++; 88 $href = $this->getApplicationURI('/issue/'.$issue->getIssueKey().'/'); 89 $item = id(new PHUIObjectItemView()) 90 ->setHeader($issue->getName()) 91 ->setHref($href) 92 ->setClickable(true) 93 ->addAttribute($issue->getSummary()); 94 if (!$issue->getIsIgnored()) { 95 $icon = id(new PHUIIconView()) 96 ->setIcon($fonticon) 97 ->setBackground('bg-sky'); 98 $item->setImageIcon($icon); 99 $list->addItem($item); 100 } else { 101 $icon = id(new PHUIIconView()) 102 ->setIcon('fa-eye-slash') 103 ->setBackground('bg-grey'); 104 $item->setDisabled(true); 105 $item->setImageIcon($icon); 106 $ignored_items[] = $item; 107 } 108 } 109 110 foreach ($ignored_items as $item) { 111 $list->addItem($item); 112 } 113 114 if ($items == 0) { 115 return null; 116 } else { 117 return $list; 118 } 119 } 120 121}