From 51ed968a13e1664bd256e2adafcb1d5e3c4f4095 Mon Sep 17 00:00:00 2001 From: Christian Helbling Date: Mon, 8 Oct 2018 09:15:19 +0200 Subject: put behaviour of --debug in it::getopt into it_debug::set so we can use that in other places as well - for example in runtests --- it.class | 11 +---------- it_debug.class | 12 ++++++++++++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/it.class b/it.class index 896d16f..0a3fc18 100644 --- a/it.class +++ b/it.class @@ -902,16 +902,7 @@ static function getopt($usage, $p = array()) } if ($result['debug']) - { - foreach (preg_split('/[.,]/', $result['debug']) as $ultrad) - { - $ultravar = preg_split('/[-=:]/', $ultrad, 2); - $GLOBALS["debug_$ultravar[0]"] = isset($ultravar[1]) ? $ultravar[1] : 1; - } - - # keep debug parameters in subrequests - $_SERVER['ULTRAHOSTNAME'] = it::replace(['^\.+' => '', '([^.])\.*$' => '\1.'], $result['debug']) . $_SERVER['ULTRAHOSTNAME']; - } + it_debug::set($result['debug']); $GLOBALS['it_stdin']['args'] = $result['args'] ? $result['args'] : array("-"); it::_stdin_next(); diff --git a/it_debug.class b/it_debug.class index d2aeb04..c508b5e 100644 --- a/it_debug.class +++ b/it_debug.class @@ -191,5 +191,17 @@ static function backtrace($p = array()) return join(" ", (array)$result); } +static function set($debug_string) +{ + foreach (preg_split('/[.,]/', $debug_string) as $ultrad) + { + $ultravar = preg_split('/[-=:]/', $ultrad, 2); + $GLOBALS["debug_$ultravar[0]"] = isset($ultravar[1]) ? $ultravar[1] : 1; + } + + # keep debug parameters in subrequests + $_SERVER['ULTRAHOSTNAME'] = it::replace(['^\.+' => '', '([^.])\.*$' => '\1.'], $debug_string) . $_SERVER['ULTRAHOSTNAME']; +} + } ?> -- cgit v1.2.3