getVersion method
This commit is contained in:
@@ -36,16 +36,12 @@ use Espo\Core\Utils\Config;
|
||||
|
||||
class Version implements Command
|
||||
{
|
||||
public function __construct(private Config $config)
|
||||
public function __construct(private Config\SystemConfig $config)
|
||||
{}
|
||||
|
||||
public function run(Params $params, IO $io): void
|
||||
{
|
||||
$version = $this->config->get('version');
|
||||
|
||||
if (is_null($version)) {
|
||||
return;
|
||||
}
|
||||
$version = $this->config->getVersion();
|
||||
|
||||
$io->writeLine($version);
|
||||
}
|
||||
|
||||
@@ -38,15 +38,15 @@ class VersionDataProvider
|
||||
private string $defaultConfigPath = 'application/Espo/Resources/defaults/config.php';
|
||||
|
||||
public function __construct(
|
||||
private Config $config,
|
||||
private Manager $fileManager
|
||||
private Manager $fileManager,
|
||||
private Config\SystemConfig $systemConfig,
|
||||
) {}
|
||||
|
||||
public function getPreviousVersion(): string
|
||||
{
|
||||
$version = $this->config->get('version');
|
||||
$version = $this->systemConfig->getVersion();
|
||||
|
||||
if (!is_string($version) || !$version) {
|
||||
if (!$version) {
|
||||
throw new RuntimeException("No or bad 'version' in config.");
|
||||
}
|
||||
|
||||
|
||||
@@ -45,4 +45,9 @@ class SystemConfig
|
||||
{
|
||||
return (bool) $this->config->get('useCache');
|
||||
}
|
||||
|
||||
public function getVersion(): string
|
||||
{
|
||||
return (string) $this->config->get('version');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class Manager
|
||||
return null;
|
||||
}
|
||||
|
||||
$currentVersion = $this->config->get('version');
|
||||
$currentVersion = $this->systemConfig->getVersion();
|
||||
|
||||
if ($currentVersion === 'dev') {
|
||||
return null;
|
||||
|
||||
@@ -43,7 +43,7 @@ class GetAbout implements Action
|
||||
{
|
||||
public function __construct(
|
||||
private FileReader $fileReader,
|
||||
private Config $config
|
||||
private Config\SystemConfig $systemConfig,
|
||||
) {}
|
||||
|
||||
public function process(Request $request): Response
|
||||
@@ -52,7 +52,7 @@ class GetAbout implements Action
|
||||
|
||||
return ResponseComposer::json([
|
||||
'text' => $text,
|
||||
'version' => $this->config->get('version'),
|
||||
'version' => $this->systemConfig->getVersion(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user