Fix try fix function not found of qodana
This commit is contained in:
parent
62d3348471
commit
2eb054a170
@ -389,13 +389,13 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
$usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
||||
$foundonealgorithm = 0;
|
||||
if ($usecompression) {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress')) {
|
||||
$foundonealgorithm++;
|
||||
}
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
|
||||
$foundonealgorithm++;
|
||||
}
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
|
||||
$foundonealgorithm++;
|
||||
}
|
||||
if (!$foundonealgorithm) {
|
||||
@ -413,13 +413,13 @@ $result = $api->r->handle();
|
||||
|
||||
if (Luracast\Restler\Defaults::$returnResponse) {
|
||||
// We try to compress the data received data
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress') && defined('BROTLI_TEXT')) {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress') && defined('BROTLI_TEXT')) {
|
||||
header('Content-Encoding: br');
|
||||
$result = brotli_compress($result, 11, constant('BROTLI_TEXT'));
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
|
||||
header('Content-Encoding: bz');
|
||||
$result = bzcompress($result, 9);
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
|
||||
header('Content-Encoding: gzip');
|
||||
$result = gzencode($result, 9);
|
||||
} else {
|
||||
|
||||
@ -144,10 +144,12 @@ class DolGeoIP
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
if (!function_exists('geoip_country_code_by_addr_v6')) {
|
||||
if (function_exists('geoip_country_code_by_addr_v6')) {
|
||||
return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip));
|
||||
} elseif (function_exists('geoip_country_code_by_name_v6')) {
|
||||
return strtolower(geoip_country_code_by_name_v6($this->gi, $ip));
|
||||
}
|
||||
return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip));
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -932,8 +932,10 @@ class Translate
|
||||
$fonc = 'numberwords';
|
||||
if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) {
|
||||
include_once $newdir.'/functions_'.$fonc.'.lib.php';
|
||||
$newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
|
||||
break;
|
||||
if (function_exists('numberwords_getLabelFromNumber')) {
|
||||
$newnumber = numberwords_getLabelFromNumber($this, $number, $isamount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2058,13 +2058,13 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
|
||||
dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile);
|
||||
|
||||
$data = implode("", file(dol_osencode($inputfile)));
|
||||
if ($mode == 'gz') {
|
||||
if ($mode == 'gz' && function_exists('gzencode')) {
|
||||
$foundhandler = 1;
|
||||
$compressdata = gzencode($data, 9);
|
||||
} elseif ($mode == 'bz') {
|
||||
} elseif ($mode == 'bz' && function_exists('bzcompress')) {
|
||||
$foundhandler = 1;
|
||||
$compressdata = bzcompress($data, 9);
|
||||
} elseif ($mode == 'zstd') {
|
||||
} elseif ($mode == 'zstd' && function_exists('zstd_compress')) {
|
||||
$foundhandler = 1;
|
||||
$compressdata = zstd_compress($data, 9);
|
||||
} elseif ($mode == 'zip') {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user