From 4ee2d3db26d1e84988a86ba72d7377130ed0efbe Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 20 Apr 2022 17:04:41 +0200 Subject: create generic it::servertype() --- it.class | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/it.class b/it.class index 161893a..022db61 100644 --- a/it.class +++ b/it.class @@ -368,7 +368,7 @@ static function _exit($p) */ static function is_live() { - return (preg_match("/^live/", $GLOBALS['ULTRASERVERTYPE']) || !$GLOBALS['ULTRASERVERTYPE'] || EDC('aslive')) && !EDC('asdevel'); + return it::servertype('live'); } @@ -378,7 +378,15 @@ static function is_live() */ static function is_devel() { - return (preg_match("/^devel/", $GLOBALS['ULTRASERVERTYPE']) || EDC('asdevel')) && !EDC('aslive'); + return it::servertype('devel'); +} + +/** + * Check if running on given server type(s) + */ +static function servertype($pattern) +{ + return it::match($pattern, $GLOBALS['ULTRASERVERTYPE'] ?: 'live'); } -- cgit v1.2.3