[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorNotificationStatusController 4 extends PhabricatorNotificationController { 5 6 public function processRequest() { 7 try { 8 $status = PhabricatorNotificationClient::getServerStatus(); 9 $status = $this->renderServerStatus($status); 10 } catch (Exception $ex) { 11 $status = new AphrontErrorView(); 12 $status->setTitle('Notification Server Issue'); 13 $status->appendChild(hsprintf( 14 'Unable to determine server status. This probably means the server '. 15 'is not in great shape. The specific issue encountered was:'. 16 '<br />'. 17 '<br />'. 18 '<strong>%s</strong> %s', 19 get_class($ex), 20 phutil_escape_html_newlines($ex->getMessage()))); 21 } 22 23 $crumbs = $this->buildApplicationCrumbs(); 24 $crumbs->addTextCrumb(pht('Status')); 25 26 return $this->buildApplicationPage( 27 array( 28 $crumbs, 29 $status, 30 ), 31 array( 32 'title' => pht('Notification Server Status'), 33 'device' => false, 34 )); 35 } 36 37 private function renderServerStatus(array $status) { 38 39 $rows = array(); 40 foreach ($status as $key => $value) { 41 switch ($key) { 42 case 'uptime': 43 $value /= 1000; 44 $value = phutil_format_relative_time_detailed($value); 45 break; 46 case 'log': 47 break; 48 default: 49 $value = number_format($value); 50 break; 51 } 52 53 $rows[] = array($key, $value); 54 } 55 56 $table = new AphrontTableView($rows); 57 $table->setColumnClasses( 58 array( 59 'header', 60 'wide', 61 )); 62 63 $test_icon = id(new PHUIIconView()) 64 ->setIconFont('fa-exclamation-triangle'); 65 66 $test_button = id(new PHUIButtonView()) 67 ->setTag('a') 68 ->setWorkflow(true) 69 ->setText(pht('Send Test Notification')) 70 ->setHref($this->getApplicationURI('test/')) 71 ->setIcon($test_icon); 72 73 $header = id(new PHUIHeaderView()) 74 ->setHeader(pht('Notification Server Status')) 75 ->addActionLink($test_button); 76 77 $box = id(new PHUIObjectBoxView()) 78 ->setHeader($header) 79 ->appendChild($table); 80 81 return $box; 82 } 83 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |