提交 a11f4e4f authored 作者: Anthony Minessale's avatar Anthony Minessale

add auto-create-schemas param to switch.conf.xml

上级 0ec9ffe6
......@@ -252,7 +252,8 @@ typedef enum {
SCF_USE_HEAVY_TIMING = (1 << 9),
SCF_USE_CLOCK_RT = (1 << 10),
SCF_VERBOSE_EVENTS = (1 << 11),
SCF_USE_WIN32_MONOTONIC = (1 << 12)
SCF_USE_WIN32_MONOTONIC = (1 << 12),
SCF_AUTO_SCHEMAS = (1 << 13)
} switch_core_flag_enum_t;
typedef uint32_t switch_core_flag_t;
......
......@@ -1227,6 +1227,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
switch_set_flag((&runtime.dummy_cng_frame), SFF_CNG);
switch_set_flag((&runtime), SCF_AUTO_SCHEMAS);
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
runtime.hard_log_level = SWITCH_LOG_DEBUG;
......@@ -1261,9 +1262,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.sounds_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_mutex_init(&runtime.uuid_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_mutex_init(&runtime.global_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
switch_mutex_init(&runtime.global_var_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
......@@ -1272,7 +1275,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_event_create_plain(&runtime.global_vars, SWITCH_EVENT_CHANNEL_DATA);
switch_core_hash_init(&runtime.mime_types, runtime.memory_pool);
load_mime_types();
runtime.flags = flags;
runtime.flags |= flags;
runtime.sps_total = 30;
*err = NULL;
......@@ -1314,9 +1317,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.tipping_point = 5000;
runtime.timer_affinity = -1;
switch_load_core_config("switch.conf");
switch_core_state_machine_init(runtime.memory_pool);
if (switch_core_sqldb_start(runtime.memory_pool, switch_test_flag((&runtime), SCF_USE_SQL) ? SWITCH_TRUE : SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
......@@ -1435,6 +1438,12 @@ static void switch_load_core_config(const char *file)
if (tmp > -1 && tmp < 11) {
switch_core_session_ctl(SCSC_DEBUG_LEVEL, &tmp);
}
} else if (!strcasecmp(var, "auto-create-schemas")) {
if (switch_true(val)) {
switch_set_flag((&runtime), SCF_AUTO_SCHEMAS);
} else {
switch_clear_flag((&runtime), SCF_AUTO_SCHEMAS);
}
} else if (!strcasecmp(var, "enable-early-hangup") && switch_true(val)) {
switch_set_flag((&runtime), SCF_EARLY_HANGUP);
} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
......@@ -1553,7 +1562,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
if (switch_core_init(flags, console, err) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_GENERR;
}
if (runtime.runlevel > 1) {
/* one per customer */
return SWITCH_STATUS_SUCCESS;
......@@ -1583,7 +1592,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t
#endif
signal(SIGHUP, handle_SIGHUP);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n");
if (switch_loadable_module_init() != SWITCH_STATUS_SUCCESS) {
......
......@@ -196,6 +196,11 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te
{
char *errmsg;
if (switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) {
return;
}
if (db) {
if (test_sql) {
switch_core_db_exec(db, test_sql, NULL, NULL, &errmsg);
......
......@@ -784,6 +784,10 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand
char *errmsg;
switch_bool_t r = SWITCH_TRUE;
if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) {
return SWITCH_TRUE;
}
if (dbh->io_mutex) {
switch_mutex_lock(dbh->io_mutex);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论