[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/xhprof/controller/ -> PhabricatorXHProfProfileController.php (source)

   1  <?php
   2  
   3  final class PhabricatorXHProfProfileController
   4    extends PhabricatorXHProfController {
   5  
   6    private $phid;
   7  
   8    public function willProcessRequest(array $data) {
   9      $this->phid = $data['phid'];
  10    }
  11  
  12    public function processRequest() {
  13      $request = $this->getRequest();
  14  
  15      $file = id(new PhabricatorFileQuery())
  16        ->setViewer($request->getUser())
  17        ->withPHIDs(array($this->phid))
  18        ->executeOne();
  19      if (!$file) {
  20        return new Aphront404Response();
  21      }
  22  
  23      $data = $file->loadFileData();
  24      $data = @json_decode($data, true);
  25      if (!$data) {
  26        throw new Exception('Failed to unserialize XHProf profile!');
  27      }
  28  
  29      $symbol = $request->getStr('symbol');
  30  
  31      $is_framed = $request->getBool('frame');
  32  
  33      if ($symbol) {
  34        $view = new PhabricatorXHProfProfileSymbolView();
  35        $view->setSymbol($symbol);
  36      } else {
  37        $view = new PhabricatorXHProfProfileTopLevelView();
  38        $view->setFile($file);
  39        $view->setLimit(100);
  40      }
  41  
  42      $view->setBaseURI($request->getRequestURI()->getPath());
  43      $view->setIsFramed($is_framed);
  44      $view->setProfileData($data);
  45  
  46      return $this->buildStandardPageResponse(
  47        $view,
  48        array(
  49          'title' => 'Profile',
  50          'frame' => $is_framed,
  51        ));
  52    }
  53  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1