Skip to content

Commit

Permalink
Merge pull request #97 from mrysav/mrysav/fix-local-language-refresh
Browse files Browse the repository at this point in the history
Refresh `local/langdata_` folders on login when they don't exist
  • Loading branch information
mrysav authored Sep 21, 2024
2 parents 8637973 + 748427e commit 1c8ada3
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
4 changes: 2 additions & 2 deletions htdocs/Language/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,11 @@
</term>
<term>
<key>SPECIMEN_CUSTOM_FIELDS</key>
<value>Specimen Custom Fields</key>
<value>Specimen Custom Fields</value>
</term>
<term>
<key>PATIENT_CUSTOM_FIELDS</key>
<value>Patient Custom Fields</key>
<value>Patient Custom Fields</value>
</term>
</page>
<page id="header" descr="Page Header">
Expand Down
4 changes: 2 additions & 2 deletions htdocs/Language/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,11 @@
</term>
<term>
<key>SPECIMEN_CUSTOM_FIELDS</key>
<value>Specimen Custom Fields</key>
<value>Specimen Custom Fields</value>
</term>
<term>
<key>PATIENT_CUSTOM_FIELDS</key>
<value>Patient Custom Fields</key>
<value>Patient Custom Fields</value>
</term>
</page>
<page id="header" descr="Page Header">
Expand Down
23 changes: 23 additions & 0 deletions htdocs/includes/composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,27 @@
mkdir(__DIR__."/../../files", 0755);
}

require_once(__DIR__."/platform_lib.php");

# Ensure that we create the language files in local/
# if they don't exist yet.

$lab_config_id = null;
if (isset($_SESSION["lab_config_id"])) {
$lab_config_id = $_SESSION["lab_config_id"];
}

$lang_template_path = realpath(__DIR__."/../Language/");
$local_path = realpath(__DIR__."/../../local");

if (!file_exists("$local_path/langdata_revamp/")) {
$log->warn("$local_path/langdata_revamp does not exist, copying template");
PlatformLib::copyDirectory($lang_template_path, "$local_path/langdata_revamp/");
}

if ($lab_config_id != null && !file_exists("$local_path/langdata_$lab_config_id/")) {
$log->warn("$local_path/langdata_$lab_config_id does not exist, copying template");
PlatformLib::copyDirectory($lang_template_path, "$local_path/langdata_$lab_config_id/");
}

?>
2 changes: 1 addition & 1 deletion htdocs/users/login.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

require_once(__DIR__."/../includes/composer.php");
include("redirect.php");
include("includes/stats_lib.php");
include("includes/password_reset_need.php");
Expand Down

0 comments on commit 1c8ada3

Please sign in to comment.