mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #3083 from HB9HIL/datatables_lang
Cache Buster Log Flood
This commit is contained in:
@@ -37,11 +37,6 @@ class Paths
|
||||
// make sure $filepath starts with a slash
|
||||
if (substr($filepath, 0, 1) !== '/') $filepath = '/' . $filepath;
|
||||
|
||||
// These files are not existent on purpose and should not trigger error logs
|
||||
$err_exceptions = [
|
||||
'/assets/json/datatables_languages/en-US.json',
|
||||
];
|
||||
|
||||
$CI = & get_instance();
|
||||
$fullpath = empty($CI->config->item('directory')) ? $_SERVER['DOCUMENT_ROOT'] . $filepath : $_SERVER['DOCUMENT_ROOT'] . '/' . $CI->config->item('directory') . $filepath;
|
||||
|
||||
@@ -52,9 +47,7 @@ class Paths
|
||||
if (file_exists($fullpath)) {
|
||||
return base_url($filepath) . '?v=' . filemtime($fullpath);
|
||||
} else {
|
||||
if (!in_array($filepath, $err_exceptions)) {
|
||||
log_message('error', 'CACHE BUSTER: File does not exist: ' . $fullpath);
|
||||
}
|
||||
log_message('error', 'CACHE BUSTER: File does not exist: ' . $fullpath);
|
||||
}
|
||||
return base_url($filepath);
|
||||
}
|
||||
|
||||
@@ -180,32 +180,27 @@
|
||||
<!-- DATATABLES LANGUAGE -->
|
||||
<?php
|
||||
$local_code = $language['locale'];
|
||||
$lang_code = $language['code'];
|
||||
$file_path = $this->paths->cache_buster('/assets/json/datatables_languages/' . $local_code . '.json');
|
||||
$lang_code = $language['code'];
|
||||
|
||||
// Check if the file exists
|
||||
if ($lang_code != 'en' && !file_exists(FCPATH . "assets/json/datatables_languages/" . $local_code . ".json")) {
|
||||
$datatables_language_url = '';
|
||||
} else {
|
||||
$datatables_language_url = $file_path;
|
||||
$datatables_language_url = '';
|
||||
if ($lang_code !== 'en' && file_exists(FCPATH . "assets/json/datatables_languages/" . $local_code . ".json")) {
|
||||
$datatables_language_url = $this->paths->cache_buster('/assets/json/datatables_languages/' . $local_code . '.json');
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
function getDataTablesLanguageUrl() {
|
||||
locale = "<?php echo $local_code ?>";
|
||||
lang_code = "<?php echo $lang_code; ?>";
|
||||
datatables_language_url = "<?php echo $datatables_language_url; ?>";
|
||||
const datatables_language_url = "<?php echo $datatables_language_url; ?>";
|
||||
|
||||
// if language is set to english we don't need to load any language files
|
||||
if (lang_code != 'en') {
|
||||
if (datatables_language_url !== '') {
|
||||
return datatables_language_url;
|
||||
} else {
|
||||
console.error("Datatables language file does not exist for locale: " + locale);
|
||||
return null;
|
||||
}
|
||||
if (datatables_language_url !== '') {
|
||||
return datatables_language_url;
|
||||
}
|
||||
|
||||
<?php if ($lang_code !== 'en'): ?>
|
||||
console.warn("Datatables language file does not exist for locale: <?php echo $local_code; ?>; Using english instead.");
|
||||
<?php endif; ?>
|
||||
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
<!-- DATATABLES LANGUAGE END -->
|
||||
|
||||
@@ -27,32 +27,27 @@
|
||||
<!-- DATATABLES LANGUAGE -->
|
||||
<?php
|
||||
$local_code = $language['locale'];
|
||||
$lang_code = $language['code'];
|
||||
$file_path = $this->paths->cache_buster('/assets/json/datatables_languages/' . $local_code . '.json');
|
||||
$lang_code = $language['code'];
|
||||
|
||||
// Check if the file exists
|
||||
if ($lang_code != 'en' && !file_exists(FCPATH . "assets/json/datatables_languages/" . $local_code . ".json")) {
|
||||
$datatables_language_url = '';
|
||||
} else {
|
||||
$datatables_language_url = $file_path;
|
||||
$datatables_language_url = '';
|
||||
if ($lang_code !== 'en' && file_exists(FCPATH . "assets/json/datatables_languages/" . $local_code . ".json")) {
|
||||
$datatables_language_url = $this->paths->cache_buster('/assets/json/datatables_languages/' . $local_code . '.json');
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
function getDataTablesLanguageUrl() {
|
||||
locale = "<?php echo $local_code ?>";
|
||||
lang_code = "<?php echo $lang_code; ?>";
|
||||
datatables_language_url = "<?php echo $datatables_language_url; ?>";
|
||||
const datatables_language_url = "<?php echo $datatables_language_url; ?>";
|
||||
|
||||
// if language is set to english we don't need to load any language files
|
||||
if (lang_code != 'en') {
|
||||
if (datatables_language_url !== '') {
|
||||
return datatables_language_url;
|
||||
} else {
|
||||
console.error("Datatables language file does not exist for locale: " + locale);
|
||||
return null;
|
||||
}
|
||||
if (datatables_language_url !== '') {
|
||||
return datatables_language_url;
|
||||
}
|
||||
|
||||
<?php if ($lang_code !== 'en'): ?>
|
||||
console.warn("Datatables language file does not exist for locale: <?php echo $local_code; ?>; Using english instead.");
|
||||
<?php endif; ?>
|
||||
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
<!-- DATATABLES LANGUAGE END -->
|
||||
|
||||
Reference in New Issue
Block a user