How to keep module enabled across instances in Magento 2? Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How to change theme for magento multiple store?Configuration MigrationMagento 2: How to Read From Configuration TreeMagento 2 - Environment dependent configurationConditional RequireJs configuration (Load requirejs-config.js programmatically?)How can I find all config entries for enabled payment or shipping methods and copy them to another store?How to print all magento configurations (config array) : Magento 2Magento 2 CAPTCHA not showing when enabledHow to Migrate two different Magento 1 instances to Magento 2?Magento 2: how to hide product from minicart
Could a cockatrice have parasitic embryos?
How can I wire a 9-position switch so that each position turns on one more LED than the one before?
How to keep bees out of canned beverages?
What is a good proxy for government quality?
false 'Security alert' from Google - every login generates mails from 'no-reply@accounts.google.com'
Coin Game with infinite paradox
In search of the origins of term censor, I hit a dead end stuck with the greek term, to censor, λογοκρίνω
Where to find documentation for `whois` command options?
Raising a bilingual kid. When should we introduce the majority language?
When speaking, how do you change your mind mid-sentence?
Is Bran literally the world's memory?
Determinant of a matrix with 2 equal rows
Retract an already submitted Recommendation Letter (written for an undergrad student)
1 column , 2 columns-left , 2 columns-right , 3 column
What is ls Largest Number Formed by only moving two sticks in 508?
"Working on a knee"
What is the purpose of the side handle on a hand ("eggbeater") drill?
Does Prince Arnaud cause someone holding the Princess to lose?
How would you suggest I follow up with coworkers about our deadline that's today?
Philosophers who were composers?
What is /etc/mtab in Linux?
How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?
Was Objective-C really a hindrance to Apple software development?
When I export an AI 300x60 art board it saves with bigger dimensions
How to keep module enabled across instances in Magento 2?
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?How to change theme for magento multiple store?Configuration MigrationMagento 2: How to Read From Configuration TreeMagento 2 - Environment dependent configurationConditional RequireJs configuration (Load requirejs-config.js programmatically?)How can I find all config entries for enabled payment or shipping methods and copy them to another store?How to print all magento configurations (config array) : Magento 2Magento 2 CAPTCHA not showing when enabledHow to Migrate two different Magento 1 instances to Magento 2?Magento 2: how to hide product from minicart
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?
magento2 module configuration
add a comment |
is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?
magento2 module configuration
As per I know currently we don't have mixture of this 2 commandsphp bin/magento deploy:mode:set developer/production
&php bin/magento module:enable MODULE_NAME
– Ankit Shah
Mar 29 '17 at 8:53
Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.
– Damir Gadiev
Mar 29 '17 at 9:16
add a comment |
is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?
magento2 module configuration
is there any way to keep free contributed plugin (for example MageMonkey 2) to be enabled across different instances of website(dev, stage, prod), keeping the configuration?
magento2 module configuration
magento2 module configuration
edited 17 mins ago
Muhammad Anas
8091322
8091322
asked Mar 29 '17 at 8:35
Damir GadievDamir Gadiev
62
62
As per I know currently we don't have mixture of this 2 commandsphp bin/magento deploy:mode:set developer/production
&php bin/magento module:enable MODULE_NAME
– Ankit Shah
Mar 29 '17 at 8:53
Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.
– Damir Gadiev
Mar 29 '17 at 9:16
add a comment |
As per I know currently we don't have mixture of this 2 commandsphp bin/magento deploy:mode:set developer/production
&php bin/magento module:enable MODULE_NAME
– Ankit Shah
Mar 29 '17 at 8:53
Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.
– Damir Gadiev
Mar 29 '17 at 9:16
As per I know currently we don't have mixture of this 2 commands
php bin/magento deploy:mode:set developer/production
& php bin/magento module:enable MODULE_NAME
– Ankit Shah
Mar 29 '17 at 8:53
As per I know currently we don't have mixture of this 2 commands
php bin/magento deploy:mode:set developer/production
& php bin/magento module:enable MODULE_NAME
– Ankit Shah
Mar 29 '17 at 8:53
Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.
– Damir Gadiev
Mar 29 '17 at 9:16
Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.
– Damir Gadiev
Mar 29 '17 at 9:16
add a comment |
1 Answer
1
active
oldest
votes
Suggested solution:
I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.
More detailed explanation:
Code structure
|--app/
|--code/
|--<My Vendor>/
|-- ...
|--<My Module>/
|-- ...
|--Helper
|--Configuration.php
|--Setup/
|--UpgradeData.php # save custom module settings here
|-- ...
|--composer.json # module's composer file
|-- ...
|--vendor/
|--<ContribVendor>/
|--<ContribModule>/
|-- ...
|--composer.json # home directory composer file
|--auth.json # can be gitignored
Module composer.json sample
"name": "<My Vendor>/<My Module>",
"description": "N/A",
"require":
"php": "~5.6.5,
"type": "magento2-module",
"version": "<My Module version>",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload":
"files": [
"registration.php"
]
Upgrade script sample:
<?php
namespace <MyVendor>UpdatesSetup;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use <MyVendor><My Module>HelperConfiguration;
class UpgradeData implements UpgradeDataInterface
/**
* @var <MyVendor><My Module>HelperConfiguration
*/
protected $config;
public function __construct(
Configuration $config
)
$this->config = $config;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
try
if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
$this->config->setMyModuleSettings(); # Implemented in HELPER below.
catch (Exception $e)
print $e->getMessage();
$setup->endSetup();
Helper script sample:
<?php
namespace FFWUpdatesHelper;
use MagentoConfigModelResourceModelConfig;
use MagentoFrameworkAppHelperContext;
class Configuration extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoConfigModelResourceModelConfig
*/
protected $config;
public function construct(
Context $context,
Config $config
)
parent::__construct($context);
$this->config = $config;
/**
* Helper to set <My Module> settings.
*/
public function setMyModuleSettings()
$this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');
Final step
I my CI i run 2 steps on each deployment - during development:
magento setup:upgrade
magento setup:di:compile
Disclaimer
Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166688%2fhow-to-keep-module-enabled-across-instances-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Suggested solution:
I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.
More detailed explanation:
Code structure
|--app/
|--code/
|--<My Vendor>/
|-- ...
|--<My Module>/
|-- ...
|--Helper
|--Configuration.php
|--Setup/
|--UpgradeData.php # save custom module settings here
|-- ...
|--composer.json # module's composer file
|-- ...
|--vendor/
|--<ContribVendor>/
|--<ContribModule>/
|-- ...
|--composer.json # home directory composer file
|--auth.json # can be gitignored
Module composer.json sample
"name": "<My Vendor>/<My Module>",
"description": "N/A",
"require":
"php": "~5.6.5,
"type": "magento2-module",
"version": "<My Module version>",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload":
"files": [
"registration.php"
]
Upgrade script sample:
<?php
namespace <MyVendor>UpdatesSetup;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use <MyVendor><My Module>HelperConfiguration;
class UpgradeData implements UpgradeDataInterface
/**
* @var <MyVendor><My Module>HelperConfiguration
*/
protected $config;
public function __construct(
Configuration $config
)
$this->config = $config;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
try
if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
$this->config->setMyModuleSettings(); # Implemented in HELPER below.
catch (Exception $e)
print $e->getMessage();
$setup->endSetup();
Helper script sample:
<?php
namespace FFWUpdatesHelper;
use MagentoConfigModelResourceModelConfig;
use MagentoFrameworkAppHelperContext;
class Configuration extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoConfigModelResourceModelConfig
*/
protected $config;
public function construct(
Context $context,
Config $config
)
parent::__construct($context);
$this->config = $config;
/**
* Helper to set <My Module> settings.
*/
public function setMyModuleSettings()
$this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');
Final step
I my CI i run 2 steps on each deployment - during development:
magento setup:upgrade
magento setup:di:compile
Disclaimer
Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).
add a comment |
Suggested solution:
I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.
More detailed explanation:
Code structure
|--app/
|--code/
|--<My Vendor>/
|-- ...
|--<My Module>/
|-- ...
|--Helper
|--Configuration.php
|--Setup/
|--UpgradeData.php # save custom module settings here
|-- ...
|--composer.json # module's composer file
|-- ...
|--vendor/
|--<ContribVendor>/
|--<ContribModule>/
|-- ...
|--composer.json # home directory composer file
|--auth.json # can be gitignored
Module composer.json sample
"name": "<My Vendor>/<My Module>",
"description": "N/A",
"require":
"php": "~5.6.5,
"type": "magento2-module",
"version": "<My Module version>",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload":
"files": [
"registration.php"
]
Upgrade script sample:
<?php
namespace <MyVendor>UpdatesSetup;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use <MyVendor><My Module>HelperConfiguration;
class UpgradeData implements UpgradeDataInterface
/**
* @var <MyVendor><My Module>HelperConfiguration
*/
protected $config;
public function __construct(
Configuration $config
)
$this->config = $config;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
try
if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
$this->config->setMyModuleSettings(); # Implemented in HELPER below.
catch (Exception $e)
print $e->getMessage();
$setup->endSetup();
Helper script sample:
<?php
namespace FFWUpdatesHelper;
use MagentoConfigModelResourceModelConfig;
use MagentoFrameworkAppHelperContext;
class Configuration extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoConfigModelResourceModelConfig
*/
protected $config;
public function construct(
Context $context,
Config $config
)
parent::__construct($context);
$this->config = $config;
/**
* Helper to set <My Module> settings.
*/
public function setMyModuleSettings()
$this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');
Final step
I my CI i run 2 steps on each deployment - during development:
magento setup:upgrade
magento setup:di:compile
Disclaimer
Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).
add a comment |
Suggested solution:
I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.
More detailed explanation:
Code structure
|--app/
|--code/
|--<My Vendor>/
|-- ...
|--<My Module>/
|-- ...
|--Helper
|--Configuration.php
|--Setup/
|--UpgradeData.php # save custom module settings here
|-- ...
|--composer.json # module's composer file
|-- ...
|--vendor/
|--<ContribVendor>/
|--<ContribModule>/
|-- ...
|--composer.json # home directory composer file
|--auth.json # can be gitignored
Module composer.json sample
"name": "<My Vendor>/<My Module>",
"description": "N/A",
"require":
"php": "~5.6.5,
"type": "magento2-module",
"version": "<My Module version>",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload":
"files": [
"registration.php"
]
Upgrade script sample:
<?php
namespace <MyVendor>UpdatesSetup;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use <MyVendor><My Module>HelperConfiguration;
class UpgradeData implements UpgradeDataInterface
/**
* @var <MyVendor><My Module>HelperConfiguration
*/
protected $config;
public function __construct(
Configuration $config
)
$this->config = $config;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
try
if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
$this->config->setMyModuleSettings(); # Implemented in HELPER below.
catch (Exception $e)
print $e->getMessage();
$setup->endSetup();
Helper script sample:
<?php
namespace FFWUpdatesHelper;
use MagentoConfigModelResourceModelConfig;
use MagentoFrameworkAppHelperContext;
class Configuration extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoConfigModelResourceModelConfig
*/
protected $config;
public function construct(
Context $context,
Config $config
)
parent::__construct($context);
$this->config = $config;
/**
* Helper to set <My Module> settings.
*/
public function setMyModuleSettings()
$this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');
Final step
I my CI i run 2 steps on each deployment - during development:
magento setup:upgrade
magento setup:di:compile
Disclaimer
Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).
Suggested solution:
I've managed situation by adding required module to composer.json of my custom administrative module managing dependencies to another modules and adding UpgradeData.php with update script.
More detailed explanation:
Code structure
|--app/
|--code/
|--<My Vendor>/
|-- ...
|--<My Module>/
|-- ...
|--Helper
|--Configuration.php
|--Setup/
|--UpgradeData.php # save custom module settings here
|-- ...
|--composer.json # module's composer file
|-- ...
|--vendor/
|--<ContribVendor>/
|--<ContribModule>/
|-- ...
|--composer.json # home directory composer file
|--auth.json # can be gitignored
Module composer.json sample
"name": "<My Vendor>/<My Module>",
"description": "N/A",
"require":
"php": "~5.6.5,
"type": "magento2-module",
"version": "<My Module version>",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload":
"files": [
"registration.php"
]
Upgrade script sample:
<?php
namespace <MyVendor>UpdatesSetup;
use MagentoFrameworkSetupUpgradeDataInterface;
use MagentoFrameworkSetupModuleContextInterface;
use MagentoFrameworkSetupModuleDataSetupInterface;
use <MyVendor><My Module>HelperConfiguration;
class UpgradeData implements UpgradeDataInterface
/**
* @var <MyVendor><My Module>HelperConfiguration
*/
protected $config;
public function __construct(
Configuration $config
)
$this->config = $config;
/**
* @inheritdoc
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
$setup->startSetup();
try
if (version_compare($context->getVersion(), '<ModuleVersion>', '<='))
$this->config->setMyModuleSettings(); # Implemented in HELPER below.
catch (Exception $e)
print $e->getMessage();
$setup->endSetup();
Helper script sample:
<?php
namespace FFWUpdatesHelper;
use MagentoConfigModelResourceModelConfig;
use MagentoFrameworkAppHelperContext;
class Configuration extends MagentoFrameworkAppHelperAbstractHelper
/**
* @var MagentoConfigModelResourceModelConfig
*/
protected $config;
public function construct(
Context $context,
Config $config
)
parent::__construct($context);
$this->config = $config;
/**
* Helper to set <My Module> settings.
*/
public function setMyModuleSettings()
$this->config->saveConfig('<Config key according to schema.xml of module implementing config - ContribModule in our case>', <Value>, '<Scope>', '<ScopeId>');
Final step
I my CI i run 2 steps on each deployment - during development:
magento setup:upgrade
magento setup:di:compile
Disclaimer
Do not forget to add your api keys for contrib module to composer auth.json file (or any other authentication method for composer).
answered Mar 31 '17 at 7:42
Damir GadievDamir Gadiev
62
62
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f166688%2fhow-to-keep-module-enabled-across-instances-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
As per I know currently we don't have mixture of this 2 commands
php bin/magento deploy:mode:set developer/production
&php bin/magento module:enable MODULE_NAME
– Ankit Shah
Mar 29 '17 at 8:53
Thank You, for response. I can execute this commands in my CI scripts, I meant more generic way, for example to enable module in update script from other module, or extension allowing to keep configuration through instances, like features in drupal, or some hook around composer.
– Damir Gadiev
Mar 29 '17 at 9:16