/** * Determines whether a server is running in production mode. * @return bool */ public static function isProduction() { if (self::$productionMode === NULL) { self::$productionMode = !Nette\Configurator::detectDebugMode(); } return self::$productionMode; }
/** * Determines whether a server is running in production mode. * @return bool */ public static function isProduction() { trigger_error(__CLASS__ . ' is deprecated.', E_USER_DEPRECATED); if (self::$productionMode === NULL) { self::$productionMode = !Nette\Configurator::detectDebugMode(); } return self::$productionMode; }
public static function detectDebugMode($list = NULL) { if (isset($_SERVER['HTTP_X_BLACKFIRE_QUERY'])) { // Blackfire return FALSE; } if (strpos(php_uname('n'), 'testing-worker-') !== FALSE) { // Travis return TRUE; } return parent::detectDebugMode($list); }
/** * Detects debug mode * @param string|array IP addresses or computer names whitelist detection * @return bool */ public static function detectDebugMode($list = NULL) { // Debug mode in console if (PHP_SAPI === 'cli') { return TRUE; } // Allows SetEnv and SetEnvIf from virtual host configuration if (isset($_SERVER["DEVELOPMENT_MODE"])) { return (bool) $_SERVER["DEVELOPMENT_MODE"]; } return parent::detectDebugMode($list); }
/** * Detects debug mode by public and private keys stored in cookie. * @return bool */ protected function detectDebugModeByKey() { if (!isset($_COOKIE[self::COOKIE_SECRET]) || !is_string($_COOKIE[self::COOKIE_SECRET])) { return FALSE; } $secret = $_COOKIE[self::COOKIE_SECRET]; list($slug, $password) = static::explodeKeySlug($secret); if (!isset($this->developers[$slug])) { return FALSE; } $developer = $this->developers[$slug]; if (!$developer['ipIndependent'] && !parent::detectDebugMode($this->ips)) { return FALSE; } return \Nette\Security\Passwords::verify($password, $developer['hash']); }