1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-03 03:11:01 +01:00

Add some comment caching stuff.

This commit is contained in:
epriestley 2011-02-02 16:36:53 -08:00
parent a5c0c277ca
commit ba26f67687
5 changed files with 50 additions and 29 deletions

View file

@ -22,5 +22,6 @@ class DifferentialComment extends DifferentialDAO {
protected $revisionID; protected $revisionID;
protected $action; protected $action;
protected $content; protected $content;
protected $cache;
} }

View file

@ -29,5 +29,6 @@ class DifferentialInlineComment extends DifferentialDAO {
protected $lineLength; protected $lineLength;
protected $content; protected $content;
protected $cache;
} }

View file

@ -69,9 +69,19 @@ final class DifferentialRevisionCommentView extends AphrontView {
$content = $comment->getContent(); $content = $comment->getContent();
if (strlen(rtrim($content))) { if (strlen(rtrim($content))) {
$title = "{$author_link} {$verb} this revision:"; $title = "{$author_link} {$verb} this revision:";
$cache = $comment->getCache();
if (strlen($cache)) {
$content = $cache;
} else {
$content = $this->markupEngine->markupText($content);
if ($comment->getID()) {
$comment->setCache($content);
$comment->save();
}
}
$content = $content =
'<div class="phabricator-remarkup">'. '<div class="phabricator-remarkup">'.
$this->markupEngine->markupText($content). $content.
'</div>'; '</div>';
} else { } else {
$title = null; $title = null;

View file

@ -72,8 +72,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'', '',
'', '',
'', '',
'',
'',
); );
$rows[] = array( $rows[] = array(
phutil_render_tag( phutil_render_tag(
@ -84,9 +82,7 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
phutil_escape_html($symbol)), phutil_escape_html($symbol)),
$flat[$symbol]['ct'], $flat[$symbol]['ct'],
$flat[$symbol]['wt'], $flat[$symbol]['wt'],
'', '100%',
$flat[$symbol]['excl_wt'],
'',
); );
$rows[] = array( $rows[] = array(
@ -94,8 +90,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'', '',
'', '',
'', '',
'',
'',
); );
foreach ($parents as $key => $name) { foreach ($parents as $key => $name) {
$rows[] = array( $rows[] = array(
@ -108,8 +102,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
$data[$key]['ct'], $data[$key]['ct'],
$data[$key]['wt'], $data[$key]['wt'],
'', '',
$data[$key]['wt'],
'',
); );
} }
@ -119,33 +111,26 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'', '',
'', '',
'', '',
'',
'',
); );
$child_rows = array();
foreach ($children as $key => $name) { foreach ($children as $key => $name) {
$rows[] = array( $child_rows[] = array(
phutil_render_tag( $name,
'a',
array(
'href' => $base_uri.'?symbol='.$name,
),
phutil_escape_html($name)),
$data[$key]['ct'], $data[$key]['ct'],
$data[$key]['wt'], $data[$key]['wt'],
'', $data[$key]['wt'] / $flat[$symbol]['wt'],
$data[$key]['wt'],
'',
); );
} }
$child_rows = isort($child_rows, 2);
$child_rows = array_reverse($child_rows);
$rows = array_merge($rows, $this->formatRows($child_rows));
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Symbol', 'Symbol',
'Count', 'Count',
'Incl Wall Time', 'Wall Time',
'%',
'Excl Wall Time',
'%', '%',
)); ));
$table->setColumnClasses( $table->setColumnClasses(
@ -154,8 +139,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'n', 'n',
'n', 'n',
'n', 'n',
'n',
'n',
)); ));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
@ -164,4 +147,25 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
return $panel->render(); return $panel->render();
} }
private function formatRows($rows) {
$base_uri = $this->baseURI;
$result = array();
foreach ($rows as $row) {
$result[] = array(
phutil_render_tag(
'a',
array(
'href' => $base_uri.'?symbol='.$row[0],
),
phutil_escape_html($row[0])),
number_format($row[1]),
number_format($row[2]).' us',
sprintf('%.1f%%', 100 * $row[3]),
);
}
return $result;
}
} }

View file

@ -573,11 +573,16 @@ abstract class LiskDAO {
*/ */
protected function checkProperty($property) { protected function checkProperty($property) {
static $properties = null; static $properties = null;
if (!isset($properties)) { if ($properties === null) {
$properties = $this->getProperties(); $properties = $this->getProperties();
} }
$property = strtolower($property);
if (empty($properties[$property])) {
return null;
}
return idx($properties, strtolower($property)); return $properties[$property];
} }