Skip to content

Commit

Permalink
improve transition to language_import mode
Browse files Browse the repository at this point in the history
  • Loading branch information
blackav committed Sep 14, 2024
1 parent 54bc458 commit 5858cba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/serve_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,14 @@ serve_state_import_languages(
return 0;
}

// explicitly set 'enabled' for langs in language list
for (int lang_id = 1; lang_id <= cs->max_lang; ++lang_id) {
struct section_language_data *lang = cs->langs[lang_id];
if (lang && lang->disabled < 0 && lang->enabled < 0) {
lang->enabled = 1;
}
}

const unsigned char *compile_spool_dir = "";
#if !defined EJUDGE_COMPILE_SPOOL_DIR
err("%s: --enable-compile-spool-dir must be enabled", __FUNCTION__);
Expand Down
6 changes: 6 additions & 0 deletions lib/super_html_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ super_html_read_serve(
fprintf(flog, "Invalid language id = %d for language '%s'\n", lang->id, lang->short_name);
return -1;
}
if (lang->enabled < 0 && lang->disabled < 0) {
lang->enabled = 1;
}
if (lang->compile_server_id && lang->compile_server_id[0]) {
(void) compile_servers_get(sstate->cscs, lang->compile_server_id);
}
Expand Down Expand Up @@ -1790,6 +1793,9 @@ super_html_serve_unparse_serve_cfg(
struct section_language_data *lang = sstate->langs[i];
if (!lang) continue;

if (lang->disabled <= 0 && lang->enabled > 0) {
lang->enabled = -1;
}
if (lang->compile_id > 0 && lang->id == lang->compile_id) lang->compile_id = 0;
if (sstate->serv_langs) {
if (sstate->serv_langs[i]->id == i && !strcmp(sstate->serv_langs[i]->short_name, lang->short_name)) lang->id = 0;
Expand Down

0 comments on commit 5858cba

Please sign in to comment.