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 $action;
protected $content;
protected $cache;
}

View file

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

View file

@ -69,9 +69,19 @@ final class DifferentialRevisionCommentView extends AphrontView {
$content = $comment->getContent();
if (strlen(rtrim($content))) {
$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 =
'<div class="phabricator-remarkup">'.
$this->markupEngine->markupText($content).
$content.
'</div>';
} else {
$title = null;

View file

@ -72,8 +72,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'',
'',
'',
'',
'',
);
$rows[] = array(
phutil_render_tag(
@ -84,9 +82,7 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
phutil_escape_html($symbol)),
$flat[$symbol]['ct'],
$flat[$symbol]['wt'],
'',
$flat[$symbol]['excl_wt'],
'',
'100%',
);
$rows[] = array(
@ -94,8 +90,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'',
'',
'',
'',
'',
);
foreach ($parents as $key => $name) {
$rows[] = array(
@ -108,8 +102,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
$data[$key]['ct'],
$data[$key]['wt'],
'',
$data[$key]['wt'],
'',
);
}
@ -119,33 +111,26 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'',
'',
'',
'',
'',
);
$child_rows = array();
foreach ($children as $key => $name) {
$rows[] = array(
phutil_render_tag(
'a',
array(
'href' => $base_uri.'?symbol='.$name,
),
phutil_escape_html($name)),
$child_rows[] = array(
$name,
$data[$key]['ct'],
$data[$key]['wt'],
'',
$data[$key]['wt'],
'',
$data[$key]['wt'] / $flat[$symbol]['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->setHeaders(
array(
'Symbol',
'Count',
'Incl Wall Time',
'%',
'Excl Wall Time',
'Wall Time',
'%',
));
$table->setColumnClasses(
@ -154,8 +139,6 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
'n',
'n',
'n',
'n',
'n',
));
$panel = new AphrontPanelView();
@ -164,4 +147,25 @@ class PhabricatorXHProfProfileSymbolView extends AphrontView {
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) {
static $properties = null;
if (!isset($properties)) {
if ($properties === null) {
$properties = $this->getProperties();
}
return idx($properties, strtolower($property));
$property = strtolower($property);
if (empty($properties[$property])) {
return null;
}
return $properties[$property];
}