public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $engine = new PhabricatorSetupEngine();
     $response = $engine->execute();
     if ($response) {
         return $response;
     }
     $issues = $engine->getIssues();
     $unresolved_count = count($engine->getUnresolvedIssues());
     if ($issues) {
         require_celerity_resource('phabricator-notification-menu-css');
         $items = array();
         foreach ($issues as $issue) {
             $classes = array();
             $classes[] = 'phabricator-notification';
             if ($issue->getIsIgnored()) {
                 $classes[] = 'phabricator-notification-read';
             } else {
                 $classes[] = 'phabricator-notification-unread';
             }
             $uri = '/config/issue/' . $issue->getIssueKey() . '/';
             $title = $issue->getName();
             $summary = $issue->getSummary();
             $items[] = javelin_tag('div', array('class' => implode(' ', $classes), 'sigil' => 'notification', 'meta' => array('href' => $uri)), $title);
         }
         $content = phutil_tag_div('setup-issue-menu', $items);
     } else {
         $content = phutil_tag_div('phabricator-notification no-notifications', pht('You have no unresolved setup issues.'));
     }
     $content = hsprintf('<div class="phabricator-notification-header">%s</div>' . '%s', phutil_tag('a', array('href' => '/config/issue/'), pht('Unresolved Setup Issues')), $content);
     $json = array('content' => $content, 'number' => (int) $unresolved_count);
     return id(new AphrontAjaxResponse())->setContent($json);
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $nav = $this->buildSideNavView();
     $nav->selectFilter('issue/');
     $engine = new PhabricatorSetupEngine();
     $response = $engine->execute();
     if ($response) {
         return $response;
     }
     $issues = $engine->getIssues();
     $important = $this->buildIssueList($issues, PhabricatorSetupCheck::GROUP_IMPORTANT, 'fa-warning');
     $php = $this->buildIssueList($issues, PhabricatorSetupCheck::GROUP_PHP, 'fa-code');
     $mysql = $this->buildIssueList($issues, PhabricatorSetupCheck::GROUP_MYSQL, 'fa-database');
     $other = $this->buildIssueList($issues, PhabricatorSetupCheck::GROUP_OTHER, 'fa-question-circle');
     $no_issues = null;
     if (empty($issues)) {
         $no_issues = id(new PHUIInfoView())->setTitle(pht('No Issues'))->appendChild(pht('Your install has no current setup issues to resolve.'))->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
     }
     $title = pht('Setup Issues');
     $header = id(new PHUIHeaderView())->setHeader($title)->setProfileHeader(true);
     $crumbs = $this->buildApplicationCrumbs($nav)->addTextCrumb(pht('Setup Issues'))->setBorder(true);
     $page = array($no_issues, $important, $php, $mysql, $other);
     $content = id(new PhabricatorConfigPageView())->setHeader($header)->setContent($page);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->setNavigation($nav)->appendChild($content)->addClass('white-background');
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $issue_key = $request->getURIData('key');
     $engine = new PhabricatorSetupEngine();
     $response = $engine->execute();
     if ($response) {
         return $response;
     }
     $issues = $engine->getIssues();
     $nav = $this->buildSideNavView();
     $nav->selectFilter('issue/');
     if (empty($issues[$issue_key])) {
         $content = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Issue Resolved'))->appendChild(pht('This setup issue has been resolved. '))->appendChild(phutil_tag('a', array('href' => $this->getApplicationURI('issue/')), pht('Return to Open Issue List')));
         $title = pht('Resolved Issue');
     } else {
         $issue = $issues[$issue_key];
         $content = $this->renderIssue($issue);
         $title = $issue->getShortName();
     }
     $crumbs = $this->buildApplicationCrumbs()->setBorder(true)->addTextCrumb(pht('Setup Issues'), $this->getApplicationURI('issue/'))->addTextCrumb($title, $request->getRequestURI())->setBorder(true);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->setNavigation($nav)->appendChild($content)->addClass('white-background');
 }
コード例 #4
0
 public static final function willProcessRequest()
 {
     $issue_keys = self::getOpenSetupIssueKeys();
     if ($issue_keys === null) {
         $engine = new PhabricatorSetupEngine();
         $response = $engine->execute();
         if ($response) {
             return $response;
         }
     } else {
         if ($issue_keys) {
             // If Phabricator is configured in a cluster with multiple web devices,
             // we can end up with setup issues cached on every device. This can cause
             // a warning banner to show on every device so that each one needs to
             // be dismissed individually, which is pretty annoying. See T10876.
             // To avoid this, check if the issues we found have already been cleared
             // in the database. If they have, we'll just wipe out our own cache and
             // move on.
             $issue_keys = self::getOpenSetupIssueKeysFromDatabase();
             if ($issue_keys !== null) {
                 self::setOpenSetupIssueKeys($issue_keys, $update_database = false);
             }
         }
     }
     // Try to repair configuration unless we have a clean bill of health on it.
     // We need to keep doing this on every page load until all the problems
     // are fixed, which is why it's separate from setup checks (which run
     // once per restart).
     $needs_repair = self::getConfigNeedsRepair();
     if ($needs_repair !== false) {
         $needs_repair = self::repairConfig();
         self::setConfigNeedsRepair($needs_repair);
     }
 }