Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
index 7f3b155cdd..85815d8589 100644
--- a/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
+++ b/src/applications/xhprof/controller/PhabricatorXHProfProfileController.php
@@ -1,63 +1,57 @@
<?php
final class PhabricatorXHProfProfileController
extends PhabricatorXHProfController {
- private $phid;
-
public function shouldAllowPublic() {
return true;
}
- public function willProcessRequest(array $data) {
- $this->phid = $data['phid'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
+ public function handleRequest(AphrontRequest $request) {
+ $phid = $request->getURIData('phid');
$file = id(new PhabricatorFileQuery())
->setViewer($request->getUser())
- ->withPHIDs(array($this->phid))
+ ->withPHIDs(array($phid))
->executeOne();
if (!$file) {
return new Aphront404Response();
}
$data = $file->loadFileData();
try {
$data = phutil_json_decode($data);
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(
pht('Failed to unserialize XHProf profile!'),
$ex);
}
$symbol = $request->getStr('symbol');
$is_framed = $request->getBool('frame');
if ($symbol) {
$view = new PhabricatorXHProfProfileSymbolView();
$view->setSymbol($symbol);
} else {
$view = new PhabricatorXHProfProfileTopLevelView();
$view->setFile($file);
$view->setLimit(100);
}
$view->setBaseURI($request->getRequestURI()->getPath());
$view->setIsFramed($is_framed);
$view->setProfileData($data);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('%s Profile', $symbol));
return $this->buildStandardPageResponse(
array($crumbs, $view),
array(
'title' => pht('Profile'),
'frame' => $is_framed,
));
}
}
diff --git a/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php b/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php
index 98f20436e4..65ca5593f3 100644
--- a/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php
+++ b/src/applications/xhprof/controller/PhabricatorXHProfSampleListController.php
@@ -1,99 +1,97 @@
<?php
final class PhabricatorXHProfSampleListController
extends PhabricatorXHProfController {
- private $view;
-
public function shouldAllowPublic() {
return true;
}
- public function willProcessRequest(array $data) {
- $this->view = idx($data, 'view', 'all');
- }
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $view = $request->getURIData('view');
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ if (!$view) {
+ $view = 'all';
+ }
$pager = new PHUIPagerView();
$pager->setOffset($request->getInt('page'));
- switch ($this->view) {
+ switch ($view) {
case 'sampled':
$clause = 'sampleRate > 0';
$show_type = false;
break;
case 'my-runs':
$clause = qsprintf(
id(new PhabricatorXHProfSample())->establishConnection('r'),
'sampleRate = 0 AND userPHID = %s',
$request->getUser()->getPHID());
$show_type = false;
break;
case 'manual':
$clause = 'sampleRate = 0';
$show_type = false;
break;
case 'all':
default:
$clause = '1 = 1';
$show_type = true;
break;
}
$samples = id(new PhabricatorXHProfSample())->loadAllWhere(
'%Q ORDER BY id DESC LIMIT %d, %d',
$clause,
$pager->getOffset(),
$pager->getPageSize() + 1);
$samples = $pager->sliceResults($samples);
$pager->setURI($request->getRequestURI(), 'page');
$list = new PHUIObjectItemListView();
foreach ($samples as $sample) {
$file_phid = $sample->getFilePHID();
$item = id(new PHUIObjectItemView())
->setObjectName($sample->getID())
->setHeader($sample->getRequestPath())
->setHref($this->getApplicationURI('profile/'.$file_phid.'/'))
->addAttribute(
number_format($sample->getUsTotal())." \xCE\xBCs");
if ($sample->getController()) {
$item->addAttribute($sample->getController());
}
$item->addAttribute($sample->getHostName());
$rate = $sample->getSampleRate();
if ($rate == 0) {
$item->addIcon('flag-6', pht('Manual Run'));
} else {
$item->addIcon('flag-7', pht('Sampled (1/%d)', $rate));
}
$item->addIcon(
'none',
- phabricator_datetime($sample->getDateCreated(), $user));
+ phabricator_datetime($sample->getDateCreated(), $viewer));
$list->addItem($item);
}
$list->setPager($pager);
$list->setNoDataString(pht('There are no profiling samples.'));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('XHProf Samples'));
return $this->buildApplicationPage(
array($crumbs, $list),
array(
'title' => pht('XHProf Samples'),
));
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jul 27, 5:19 PM (1 w, 12 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
186042
Default Alt Text
(5 KB)

Event Timeline