2022-03-15 18:05:33 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-09-29 15:07:43 +08:00
|
|
|
|
|
|
|
|
use ZM\Config\ZMConfig;
|
2021-01-02 18:10:20 +08:00
|
|
|
use ZM\Utils\DataProvider;
|
2020-09-29 15:07:43 +08:00
|
|
|
|
2022-03-15 18:05:33 +08:00
|
|
|
define('ZM_START_TIME', microtime(true));
|
|
|
|
|
define('ZM_DATA', ZMConfig::get('global', 'zm_data'));
|
|
|
|
|
define('APP_VERSION', LOAD_MODE == 1 ? (json_decode(file_get_contents(DataProvider::getSourceRootDir() . '/composer.json'), true)['version'] ?? 'unknown') : 'unknown');
|
|
|
|
|
define('CRASH_DIR', ZMConfig::get('global', 'crash_dir'));
|
|
|
|
|
define('MAIN_WORKER', ZMConfig::get('global', 'worker_cache')['worker'] ?? 0);
|
|
|
|
|
if (!is_dir(ZM_DATA)) {
|
|
|
|
|
@mkdir(ZM_DATA);
|
|
|
|
|
}
|
|
|
|
|
if (!is_dir(CRASH_DIR)) {
|
|
|
|
|
@mkdir(CRASH_DIR);
|
|
|
|
|
}
|
2020-09-29 15:07:43 +08:00
|
|
|
|
2022-05-03 10:06:57 +08:00
|
|
|
const TRUE_LIST = ['yes', 'y', 'true', 'on', '是', '对', true];
|
|
|
|
|
const FALSE_LIST = ['no', 'n', 'false', 'off', '否', '错', false];
|
|
|
|
|
|
2022-03-15 18:05:33 +08:00
|
|
|
const CONN_WEBSOCKET = 0;
|
|
|
|
|
const CONN_HTTP = 1;
|
|
|
|
|
const ZM_MATCH_ALL = 0;
|
|
|
|
|
const ZM_MATCH_FIRST = 1;
|
|
|
|
|
const ZM_MATCH_NUMBER = 2;
|
|
|
|
|
const ZM_MATCH_SECOND = 3;
|
|
|
|
|
const ZM_BREAKPOINT = 'if(\ZM\Framework::$argv["debug-mode"]) extract(\Psy\debug(get_defined_vars(), isset($this) ? $this : @get_called_class()));';
|
|
|
|
|
const BP = ZM_BREAKPOINT;
|
|
|
|
|
const ZM_DEFAULT_FETCH_MODE = 4;
|
2021-03-29 15:34:24 +08:00
|
|
|
|
2022-03-15 18:05:33 +08:00
|
|
|
const ZM_LOG_ERROR = 0;
|
|
|
|
|
const ZM_LOG_WARNING = 1;
|
|
|
|
|
const ZM_LOG_INFO = 2;
|
|
|
|
|
const ZM_LOG_VERBOSE = 3;
|
|
|
|
|
const ZM_LOG_DEBUG = 4;
|