From 54ffb97ed434f018dce47dc903ea1134ede9b04e Mon Sep 17 00:00:00 2001 From: rmartin Date: Thu, 16 Feb 2023 10:51:58 +0100 Subject: [PATCH] test properties --- lizmap/modules/lizmap/classes/lizmapServices.class.php | 4 +++- .../lizmapconfig/lizmapconfig.configcompiler.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lizmap/modules/lizmap/classes/lizmapServices.class.php b/lizmap/modules/lizmap/classes/lizmapServices.class.php index 0868481243..a704dc9f18 100644 --- a/lizmap/modules/lizmap/classes/lizmapServices.class.php +++ b/lizmap/modules/lizmap/classes/lizmapServices.class.php @@ -286,8 +286,10 @@ public function __construct($readConfigPath, $globalConfig, $ldapEnabled, $varPa if (isset($readConfigPath['services']['userAgent'])) { // may be set to false if already set in the php.ini $userAgent = $readConfigPath['services']['userAgent']; - } else { + } elseif (property_exists($globalConfig, 'lizmap')) { $userAgent = $globalConfig->lizmap['version']; + } else { + $userAgent = 'lizmap'; } if ($userAgent && !ini_get('user_agent')) { ini_set('user_agent', $userAgent); diff --git a/lizmap/plugins/configcompiler/lizmapconfig/lizmapconfig.configcompiler.php b/lizmap/plugins/configcompiler/lizmapconfig/lizmapconfig.configcompiler.php index a845779d55..681e6b8a0b 100644 --- a/lizmap/plugins/configcompiler/lizmapconfig/lizmapconfig.configcompiler.php +++ b/lizmap/plugins/configcompiler/lizmapconfig/lizmapconfig.configcompiler.php @@ -30,7 +30,9 @@ public function onModule($config, $moduleName, $modulePath, $xml) if ($moduleName == 'lizmap') { // we store the version into the configuration file, it avoids // to read it from the project.xml file, as it is an heavy process. - $config->lizmap['version'] = (string) $xml->info->version; + if (property_exists($config, 'lizmap')) { + $config->lizmap['version'] = (string) $xml->info->version; + } } }