Skip to content

Commit

Permalink
Merged PR 33951: Get module version from composer.json
Browse files Browse the repository at this point in the history
## What's being changed

We're removing `setup_version` from the module.xml file, and using composer.json to decide the version that is output in the dashboard.

## Why it's being changed

Now that we've fully adopted declarative schema, we no longer need to have `setup_version`.

## How to review / test this change

- Review the dashboard
- Run `setup:upgrade`

Related work items: #159467
  • Loading branch information
sta1r committed Nov 22, 2021
1 parent b3abea3 commit 1555a7d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions Plugin/ModulePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
namespace Dotdigitalgroup\Chat\Plugin;

use Dotdigitalgroup\Email\Model\Connector\Module;
use Magento\Framework\Module\ModuleListInterface;

class ModulePlugin
{
const MODULE_NAME = 'Dotdigitalgroup_Chat';
const MODULE_DESCRIPTION = 'Dotdigital Chat for Magento 2';

/**
* @var ModuleListInterface
* @var Module
*/
private $fullModuleList;
private $module;

/**
* @param ModuleListInterface $moduleListInterface
* @param Module $module
*/
public function __construct(ModuleListInterface $moduleListInterface)
public function __construct(Module $module)
{
$this->fullModuleList = $moduleListInterface;
$this->module = $module;
}

/**
Expand All @@ -32,7 +31,7 @@ public function beforeFetchActiveModules(Module $module, array $modules = [])
{
$modules[] = [
'name' => self::MODULE_DESCRIPTION,
'version' => $this->fullModuleList->getOne(self::MODULE_NAME)['setup_version']
'version' => $this->module->getModuleVersion(self::MODULE_NAME)
];
return [
$modules
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dotmailer/dotmailer-magento2-extension-chat",
"description": "Dotdigital for Magento 2: Chat module",
"type": "magento2-module",
"version": "1.5.0",
"version": "1.6.0-RC1",
"license": "MIT",
"repositories": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Dotdigitalgroup_Chat" setup_version="1.5.0">
<module name="Dotdigitalgroup_Chat">
<sequence>
<module name="Dotdigitalgroup_Email" />
<module name="Magento_Directory" />
Expand Down

0 comments on commit 1555a7d

Please sign in to comment.