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

[console] Add option for maintenance mode in certain commands #3313

Closed
littlethoughts opened this issue May 16, 2017 · 8 comments
Closed

[console] Add option for maintenance mode in certain commands #3313

littlethoughts opened this issue May 16, 2017 · 8 comments

Comments

@littlethoughts
Copy link

Problem/Motivation

It would be nice to have an option whether the site should be put into maintenance mode, like --maintenance-mode for example.

More control over the command and a faster execution should be the outcome

@jmolivas
Copy link
Member

@littlethoughts can you elaborate more on this feature request?

@LOBsTerr
Copy link
Member

PR for DC: #3811
PR for DC Core: hechoendrupal/drupal-console-core#326

I have create a new maintenance listener, which checks maintenance property on the command and enable/ disable maintenance mode.
Currently, I enabled this functionality only for DB restore command.
Please, let me know for which command we need this functionality.

@littlethoughts
Copy link
Author

Cool, how could I test it?

I have a custom command where it would be useful, which is assembling config files. I could also achieve this functionality by writing a chain command I think. If that is much simpler than integrating your solution maybe that's enough.

From the top of my head, these would also be candidates, because they could be run in a production environment and take some time / need to preserve a state:

  • database:dump
  • cache:rebuild
  • config:import
  • queue:run

@jmolivas
Copy link
Member

jmolivas commented Mar 2, 2018

@littlethoughts I have not tested this auto-maintenance-mode feature.

But what we commonly used chain commands is kinda like this. Add a new chain file at console/chain/build.yml
Containing this:

command:
  name: build
  description: 'Build site'
commands:
  # Import configuration
  - command: config:import
  # Rebuild caches.
  - command: cache:rebuild
    arguments:
        cache: all

Then use it as:

drupal build

@LOBsTerr
Copy link
Member

LOBsTerr commented Mar 3, 2018

@littlethoughts

In the configure method you need to call enableMaintenance, I can change to an option

https://github.com/hechoendrupal/drupal-console/pull/3811/files

@jmolivas
Copy link
Member

jmolivas commented Mar 3, 2018

@LOBsTerr I think as command configuration is great.

When you mentioned as change to an option you mean a command or a global option?

@LOBsTerr
Copy link
Member

@jmolivas I meant global. It can be useful for developers of custom commands

@LOBsTerr
Copy link
Member

I'm closing the issue, feel free to reopen it if you have any other ideas

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

No branches or pull requests

3 participants