[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/system/controller/ -> PhabricatorDebugController.php (source)

   1  <?php
   2  
   3  /**
   4   * This controller eases debugging of application problems that don't repro
   5   * locally by allowing installs to add arbitrary debugging code easily. To use
   6   * it:
   7   *
   8   *  - Write some diagnostic script.
   9   *  - Instruct the user to install it in `/support/debug.php`.
  10   *  - Tell them to visit `/debug/`.
  11   */
  12  final class PhabricatorDebugController extends PhabricatorController {
  13  
  14    public function shouldRequireLogin() {
  15      return false;
  16    }
  17  
  18    public function processRequest() {
  19      if (!Filesystem::pathExists($this->getDebugFilePath())) {
  20        return new Aphront404Response();
  21      }
  22  
  23      $request = $this->getRequest();
  24      $user = $request->getUser();
  25  
  26      ob_start();
  27      require_once $this->getDebugFilePath();
  28      $out = ob_get_clean();
  29  
  30      $response = new AphrontWebpageResponse();
  31      $response->setContent(phutil_tag('pre', array(), $out));
  32      return $response;
  33    }
  34  
  35    private function getDebugFilePath() {
  36      $root = dirname(phutil_get_library_root('phabricator'));
  37      return $root.'/support/debug.php';
  38    }
  39  }


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