mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Fix the marketplace searching when a module config file has missed fields (#6946)
This commit is contained in:
parent
f9fc8fce7a
commit
df2a089436
@ -4,6 +4,7 @@ HumHub Changelog
|
||||
1.16.0-beta.3 (TBD)
|
||||
-----------------------------
|
||||
- Fix #5629: Legacy configuration self test not showing "OK"
|
||||
- Fix #6909: Fix the marketplace searching when a module config file has missed fields
|
||||
|
||||
|
||||
1.16.0-beta.2 (April 9, 2024)
|
||||
|
@ -69,13 +69,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,13 +79,7 @@ class Module extends \yii\base\Module
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
$info = $this->getModuleInfo();
|
||||
|
||||
if ($info['description']) {
|
||||
return $info['description'];
|
||||
}
|
||||
|
||||
return "";
|
||||
return $this->getModuleInfo()['description'] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,13 +89,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';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -134,13 +116,7 @@ class Module extends \yii\base\Module
|
||||
*/
|
||||
public function getKeywords(): array
|
||||
{
|
||||
$info = $this->getModuleInfo();
|
||||
|
||||
if ($info['keywords']) {
|
||||
return (array)$info['keywords'];
|
||||
}
|
||||
|
||||
return [];
|
||||
return $this->getModuleInfo()['keywords'] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -328,15 +304,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user