public function init() { $grav = Grav::instance(); /** @var Config $config */ $config = $grav['config']; $mode = $config->get('system.debugger.mode'); TracyDebugger::$logDirectory = $config->get('system.debugger.log.enabled') ? LOG_DIR : null; TracyDebugger::$maxDepth = $config->get('system.debugger.max_depth'); // Switch debugger into development mode if configured if ($config->get('system.debugger.enabled')) { if ($config->get('system.debugger.strict')) { TracyDebugger::$strictMode = true; } if (function_exists('ini_set')) { ini_set('display_errors', true); } if ($mode == strtolower('detect')) { TracyDebugger::$productionMode = self::DETECT; } elseif ($mode == strtolower('production')) { TracyDebugger::$productionMode = self::PRODUCTION; } else { TracyDebugger::$productionMode = self::DEVELOPMENT; } } }
/** * {@inheritDoc} */ public function onBootstrap(EventInterface $event) { /** * @var ModuleOptions $moduleOptions */ $moduleOptions = $event->getTarget()->getServiceManager()->get('LemoTracy\\Options\\ModuleOptions'); if (true === $moduleOptions->getEnabled()) { if (null !== $moduleOptions->getMode()) { Debugger::enable($moduleOptions->getMode()); } if (null !== $moduleOptions->getLogDirectory()) { Debugger::$logDirectory = $moduleOptions->getLogDirectory(); } if (null !== $moduleOptions->getLogSeverity()) { Debugger::$logSeverity = $moduleOptions->getLogSeverity(); } if (null !== $moduleOptions->getMaxDepth()) { Debugger::$maxDepth = $moduleOptions->getMaxDepth(); } if (null !== $moduleOptions->getMaxLen()) { Debugger::$maxLen = $moduleOptions->getMaxLen(); } if (null !== $moduleOptions->getShowBar()) { Debugger::$showBar = $moduleOptions->getShowBar(); } if (null !== $moduleOptions->getStrict()) { Debugger::$strictMode = $moduleOptions->getStrict(); } } }
/** * Setup testing environment * @param string $rootDir absolute path to the root of the project * @global string $_GLOBALS['TEMP_DIR'] TEMP_DIR is defined here */ public static function setup($rootDir) { // configure environment umask(0); Environment::setup(); class_alias('Tester\\Assert', 'Assert'); date_default_timezone_set('Europe/Prague'); // create temporary directory $uniqueName = isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid(); define('TEMP_DIR', $rootDir . '/tmp/' . $uniqueName); Helpers::purge(TEMP_DIR); @chmod(TEMP_DIR, 0777); // intentional silencer Debugger::$logDirectory = TEMP_DIR; }
public static function setup($rootDir) { // configure environment umask(0); Tester\Environment::setup(); class_alias('Tester\\Assert', 'Assert'); date_default_timezone_set('Europe/Prague'); // create temporary directory define('TEMP_DIR', $rootDir . '/tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid())); Tester\Helpers::purge(TEMP_DIR); @chmod(TEMP_DIR, 0777); Tracy\Debugger::$logDirectory = TEMP_DIR; // $_SERVER = array_intersect_key($_SERVER, array_flip(array( // 'PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv' // ))); $_SERVER['REQUEST_TIME'] = 1234567890; $_ENV = $_GET = $_POST = $_FILES = array(); }
public function boot() { Debugger::$logDirectory = $this->container->getParameter('kutny_tracy.exceptions_directory'); Debugger::$email = $this->container->getParameter('kutny_tracy.emails'); }
public function __construct() { Debugger::$logDirectory = $this->getLogDir(); }