Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements to module:status command #15543

Merged
merged 4 commits into from
Jul 4, 2018
Merged

Enhancements to module:status command #15543

merged 4 commits into from
Jul 4, 2018

Conversation

jissereitsma
Copy link
Contributor

Description

The CLI command module:status provides a listing of all enabled and disabled modules. However, it is hard to determine whether a certain module is enabled or disabled: You always need scrolling and the output is not easily parsed for further automation. This PR adds a couple of things:

First of all, you can inspect the status of a specific module using a command module:status Foo_Bar which either reports Module is enabled or Module is disabled or a warning Module does not exist.

Second, you can add --enabled or --disabled to only list either enabled modules or disabled modules. I didn't make this bastard-proof, so specifying both options at once (--enabled --disabled) will just run (the enabled flag is interpreted first in PHP.

The original behaviour of bin/magento module:status remains untouched. The entire CLI class is cleaned up: Importing namespaces, PHP 7 argument hinting and method extraction.

Fixed Issues (if relevant)

Not relevant.

Manual testing scenarios

With this PR you are able to run the commands as described above.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

$allModules = $this->getAllModules();
if (!in_array($moduleName, $allModules->getNames())) {
$output->writeln('<error>Module does not exist</error>');
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add return \Magento\Framework\Console\Cli::RETURN_FAILURE; here to indicate something went wrong similar to here
https://github.com/jissereitsma/magento2/blob/047097beeed4d70f437270db34681f9022ffee67/setup/src/Magento/Setup/Console/Command/AbstractMaintenanceCommand.php#L86

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I was in a rush to finalize things, but did not like the return of no error nice anyway. This is fixed now in ca4282e

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jun 5, 2018

CLA assistant check
All committers have signed the CLA.

@vadimjustus vadimjustus self-requested a review July 2, 2018 12:14
Copy link
Contributor

@vadimjustus vadimjustus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[x] Review looks good
[x] Local testing passed

@magento-engcom-team
Copy link
Contributor

Hi @vadimjustus, thank you for the review.
ENGCOM-2162 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

Hi @jissereitsma. Thank you for your contribution.
We will aim to release these changes as part of 2.2.6.
Please check the release notes for final confirmation.

Please, consider to port this solution to 2.3 release line.
You may use Porting tool to port commits automatically.

@jissereitsma
Copy link
Contributor Author

Awesome thanks. I'll work on Magento 2.3 port soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants