-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4815 from 3liz/backport-4804-to-release_3_8
[Backport release_3_8] Show Lizmap modules infos
- Loading branch information
Showing
9 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace LizmapAdmin\ModulesInfo; | ||
|
||
class ModuleMetaData | ||
{ | ||
private $slug; | ||
private $version; | ||
private $isCore; | ||
|
||
public function __construct($slug, $version, $core) | ||
{ | ||
$this->slug = $slug; | ||
$this->version = $version; | ||
$this->isCore = $core; | ||
} | ||
|
||
public function __get($name) | ||
{ | ||
if (in_array($name, array('slug', 'version', 'isCore'))) { | ||
return $this->{$name}; | ||
} | ||
|
||
throw new \DomainException(); | ||
} | ||
|
||
public function __toString() | ||
{ | ||
return $this->slug; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace LizmapAdmin\ModulesInfo; | ||
|
||
use Jelix\IniFile\IniReader; | ||
|
||
class ModulesChecker | ||
{ | ||
private const coreModules = array('jelix', | ||
'jacl2', | ||
'jacl2db', | ||
'jcommunity', | ||
'admin', | ||
'dataviz', | ||
'filter', | ||
'action', | ||
'dynamicLayers', | ||
'lizmap', | ||
'proj4php', | ||
'view', | ||
'jacl2db_admin', | ||
'jauthdb_admin', | ||
'master_admin', | ||
); | ||
|
||
public function getList($withCore = false) | ||
{ | ||
$moduleConfig = \jApp::config()->modules; | ||
|
||
// file_get_contents(\jApp::varConfigPath('installer.ini.php')); | ||
$installreRadr = new IniReader(\jApp::varConfigPath('installer.ini.php')); | ||
|
||
$enabledModuleName = array(); | ||
foreach ($moduleConfig as $paramName => $value) { | ||
if (preg_match('/(\w*)\.enabled/', $paramName, $matches) && $value == '1') { | ||
$moduleSlug = $matches[1]; | ||
$coreModule = in_array($moduleSlug, self::coreModules); | ||
if ($coreModule && !$withCore) { | ||
continue; | ||
} | ||
$version = $installreRadr->getValue($moduleSlug.'.version', 'modules'); | ||
$enabledModuleName[] = new ModuleMetaData($moduleSlug, $version, $coreModule); | ||
} | ||
} | ||
|
||
return $enabledModuleName; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters