[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { 4 5 public function getName() { 6 $count = count($this->getData()); 7 if ($count) { 8 return pht('Error Log (%d)', $count); 9 } 10 return pht('Error Log'); 11 } 12 13 public function getOrder() { 14 return 0; 15 } 16 17 public function getColor() { 18 if (count($this->getData())) { 19 return '#ff0000'; 20 } 21 return null; 22 } 23 24 public function getDescription() { 25 return pht('Shows errors and warnings.'); 26 } 27 28 public function generateData() { 29 return DarkConsoleErrorLogPluginAPI::getErrors(); 30 } 31 32 public function renderPanel() { 33 $data = $this->getData(); 34 35 $rows = array(); 36 $details = array(); 37 38 foreach ($data as $index => $row) { 39 $file = $row['file']; 40 $line = $row['line']; 41 42 $tag = phutil_tag( 43 'a', 44 array( 45 'onclick' => jsprintf('show_details(%d)', $index), 46 ), 47 $row['str'].' at ['.basename($file).':'.$line.']'); 48 $rows[] = array($tag); 49 50 $details[] = hsprintf( 51 '<div class="dark-console-panel-error-details" id="row-details-%s">'. 52 "%s\nStack trace:\n", 53 $index, 54 $row['details']); 55 56 foreach ($row['trace'] as $key => $entry) { 57 $line = ''; 58 if (isset($entry['class'])) { 59 $line .= $entry['class'].'::'; 60 } 61 $line .= idx($entry, 'function', ''); 62 $href = null; 63 if (isset($entry['file'])) { 64 $line .= ' called at ['.$entry['file'].':'.$entry['line'].']'; 65 try { 66 $user = $this->getRequest()->getUser(); 67 $href = $user->loadEditorLink($entry['file'], $entry['line'], ''); 68 } catch (Exception $ex) { 69 // The database can be inaccessible. 70 } 71 } 72 73 $details[] = phutil_tag( 74 'a', 75 array( 76 'href' => $href, 77 ), 78 $line); 79 $details[] = "\n"; 80 } 81 82 $details[] = hsprintf('</div>'); 83 } 84 85 $table = new AphrontTableView($rows); 86 $table->setClassName('error-log'); 87 $table->setHeaders(array('Error')); 88 $table->setNoDataString('No errors.'); 89 90 return phutil_tag( 91 'div', 92 array(), 93 array( 94 phutil_tag('div', array(), $table->render()), 95 phutil_tag('pre', array('class' => 'PhabricatorMonospaced'), $details), 96 )); 97 } 98 99 }
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 |