Fix a missed module config file (#6909)

This commit is contained in:
Yuriy Bakhtin 2024-04-01 11:33:49 +02:00 committed by GitHub
parent c911e08806
commit ef89a1b2a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 27 deletions

View File

@ -1,6 +1,10 @@
HumHub Changelog
================
1.15.5 (Unreleased)
-----------------------
- Enh #6899: Fix a missed module config file
1.15.4 (March 20, 2024)
-----------------------
- Enh #6888: Better support for custom caches

View File

@ -63,13 +63,7 @@ class Module extends \yii\base\Module
*/
public function getName()
{
$info = $this->getModuleInfo();
if ($info['name']) {
return $info['name'];
}
return $this->id;
return $this->getModuleInfo()['name'] ?? $this->id;
}
/**
@ -79,13 +73,7 @@ class Module extends \yii\base\Module
*/
public function getDescription()
{
$info = $this->getModuleInfo();
if ($info['description']) {
return $info['description'];
}
return "";
return $this->getModuleInfo()['description'] ?? '';
}
/**
@ -95,13 +83,7 @@ class Module extends \yii\base\Module
*/
public function getVersion()
{
$info = $this->getModuleInfo();
if ($info['version']) {
return $info['version'];
}
return "1.0";
return $this->getModuleInfo()['version'] ?? '1.0';
}
/**
@ -303,15 +285,16 @@ class Module extends \yii\base\Module
*
* @return array module.json content
*/
protected function getModuleInfo()
protected function getModuleInfo(): array
{
if ($this->_moduleInfo !== null) {
return $this->_moduleInfo;
if ($this->_moduleInfo === null) {
$configPath = $this->getBasePath() . DIRECTORY_SEPARATOR . 'module.json';
$this->_moduleInfo = file_exists($configPath)
? Json::decode(file_get_contents($configPath))
: ['id' => $this->id];
}
$moduleJson = file_get_contents($this->getBasePath() . DIRECTORY_SEPARATOR . 'module.json');
return $this->_moduleInfo = Json::decode($moduleJson);
return $this->_moduleInfo;
}
/**

View File

@ -0,0 +1,9 @@
{
"id": "ldap",
"name": "ldap",
"description": "Ldap Core",
"keywords": [
"core"
],
"version": "1.0"
}