diff options
author | Christian Helbling | 2018-10-08 09:15:19 +0200 |
---|---|---|
committer | Christian Helbling | 2018-10-08 09:15:19 +0200 |
commit | 51ed968a13e1664bd256e2adafcb1d5e3c4f4095 (patch) | |
tree | 976e16740ebaf651390435f80a1253252aa57e3a | |
parent | adadae917b981ec4cccc29951a0bf22edb8fe380 (diff) | |
download | itools-51ed968a13e1664bd256e2adafcb1d5e3c4f4095.tar.gz itools-51ed968a13e1664bd256e2adafcb1d5e3c4f4095.tar.bz2 itools-51ed968a13e1664bd256e2adafcb1d5e3c4f4095.zip |
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
-rw-r--r-- | it.class | 11 | ||||
-rw-r--r-- | it_debug.class | 12 |
2 files changed, 13 insertions, 10 deletions
@@ -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']; +} + } ?> |