diff --git a/wire/config.php b/wire/config.php index 6973b4b1..f4fb9e9d 100644 --- a/wire/config.php +++ b/wire/config.php @@ -46,28 +46,40 @@ if(!defined("PROCESSWIRE")) die(); * always have this disabled for live/production sites since it reveals more information * than is advisible for security. * - * You may also set this to the constant `Config::debugVerbose` to enable verbose debug mode, - * which uses more memory and time. + * You may also set this to one of the constants: + * - `Config::debugVerbose` (or int `2`) for verbose debug mode, which uses more memory/time. + * - `Config::debugDev` (or string `dev`) for core development debug mode, which makes it use + * newer JS libraries in some cases when we are testing them. * * #notes This enables debug mode for ALL requests. See the debugIf option for an alternative. * - * @var bool + * @var bool|string|int * */ $config->debug = false; /** * Enable debug mode if condition is met + * + * ~~~~~ + * $config->debug = false; // setting this to false required when using debugIf + * $config->debugIf = '123.123.123.123'; // true if user matches this IP address + * $config->debugIf = [ '123.123.123.123', '456.456.456.456' ]; // array of IPs (3.0.212)+ + * $config->debugIf = 'function_name_to_call'; // callable function name + * $config->debugIf = function() { // callable function (3.0.212+) + * return $_SERVER['SERVER_PORT'] === '8888'; + * }; + * ~~~~~ * * Set debug mode to be false above, and then specify any one of the following here: - * 1) IP address of user required to enable debug mode; - * 2) Your own callable function name (i.e. "debug_mode") in /site/config.php that returns - * true or false for debug mode; - * 3) PCRE regular expression to match IP address of user (must start and end with a "/" - * slash). If IP address matches, then debug mode is enabled. Regular expression - * example: /^123\.456\.789\./ would match all IP addresses that started with 123.456.789. + * - IP address of user required to enable debug mode; + * - Array of IP addresses where that debug mode should be enabled for (3.0.212+). + * - Your own callable function in /site/config.php that returns true or false for debug mode. + * - PCRE regular expression to match IP address of user (must start and end with a "/" + * slash). If IP address matches, then debug mode is enabled. Regular expression + * example: `/^123\.456\.789\./` would match all IP addresses that started with 123.456.789. * - * #notes When used, this overrides $config->debug, changing it at runtime automatically. + * #notes When used, this will override a false $config->debug, changing it at runtime automatically. * @var string * */ diff --git a/wire/core/Config.php b/wire/core/Config.php index 8cfabde3..1419d750 100644 --- a/wire/core/Config.php +++ b/wire/core/Config.php @@ -98,8 +98,8 @@ * * @property bool $advanced Special mode for ProcessWire system development. Not recommended for regular site development or production use. #pw-group-system * @property bool $demo Special mode for demonstration use that causes POST requests to be disabled. Applies to core, but may not be safe with 3rd party modules. #pw-group-system - * @property bool|int $debug Special mode for use when debugging or developing a site. Recommended TRUE when site is in development and FALSE when not. Or set to Config::debugVerbose for verbose debug mode. #pw-group-system - * @property string $debugIf Enable debug mode if condition is met #pw-group-system + * @property bool|int|string $debug Special mode for use when debugging or developing a site. Recommended TRUE when site is in development and FALSE when not. Or set to `Config::debug*` constant. #pw-group-system + * @property string|callable|array $debugIf Enable debug mode if condition is met. One of IP address to match, regex to match IP, array of IPs to match, or callable function that returns true|false. #pw-group-system * @property array $debugTools Tools, and their order, to show in debug mode (admin) #pw-group-system * * @property string $ignoreTemplateFileRegex Regular expression to ignore template files #pw-group-template-files @@ -202,6 +202,12 @@ class Config extends WireData { */ const debugVerbose = 2; + /** + * Constant for core development debug mode (makes it use newer JS libraries in some cases) + * + */ + const debugDev = 'dev'; + /** * Get config property *