You are here

public function XHProfRunsFile::__construct in XHProf 7

Same name in this branch
  1. 7 XHProfRunsFile.inc \XHProfRunsFile::__construct()
  2. 7 XHProfLib/XHProfRuns.php \XHProfRunsFile::__construct()
Same name and namespace in other branches
  1. 6 XHProfRunsFile.inc \XHProfRunsFile::__construct()
  2. 6 XHProfLib/XHProfRuns.php \XHProfRunsFile::__construct()

File

./XHProfRunsFile.inc, line 34
Definition of XHProfRunsFile.

Class

XHProfRunsFile
XHProfRuns_Default is the default implementation of the iXHProfRuns interface for saving/fetching XHProf runs.

Code

public function __construct($dir = NULL) {

  // if user hasn't passed a directory location,
  // we use the xhprof.output_dir ini setting
  // if specified, else we default to the directory
  // in which the error_log file resides.
  if (empty($dir)) {
    $dir = ini_get("xhprof.output_dir");
    if (empty($dir)) {

      // some default that at least works on unix...
      $dir = "/tmp";

      /* @todo - Put this somewhere more sensible.
         watchdog("xhprof", "Warning: Must specify directory location for XHProf runs. " .
                      "Trying {$dir} as default. You can either pass the " .
                      "directory location as an argument to the constructor " .
                      "for XHProfRuns_Default() or set xhprof.output_dir " .
                      "ini param.");
          */
    }
  }
  $this->dir = $dir;
}