Description
Steps to reproduce
- Install Magento from
develop
branch. - Switch to developer mode
php bin/magento deploy:mode:set developer
- Switch to default mode
php bin/magento deploy:mode:set default
Expected result
- Mode switched back to default
Actual result
- Error message appears: "Cannot switch into given mode 'default'".
I know the cause is Magento/Deploy/Console/Command/SetModeCommand.php
, there's no way to switch back to "default" mode:
switch($toMode) {
case State::MODE_DEVELOPER:
$modeController->enableDeveloperMode();
break;
case State::MODE_PRODUCTION:
if ($skipCompilation) {
$modeController->enableProductionModeMinimal();
} else {
$modeController->enableProductionMode();
}
break;
default:
throw new LocalizedException(__('Cannot switch into given mode "%1"', $toMode));
}
So I created an issue on Magento SE: http://magento.stackexchange.com/questions/112523/why-cant-one-switch-back-to-the-default-mode-on-magento-2
I don't want to be rude (and I know how Alan Kent deals with rude people, I won't start playing that game ^^) but it seems like most of the feedback I got was "this mode is useless, only used when installing Magento". Also got some feedback which was this default mode is for "dudes who try things out on $5 hosting envs or expect things to just work and have not enough skill to fiddle with more"
Let's take a very easy case suggested by Kristof at Fooman: I have developped an extension and some of my customers might be running in default mode. Apart from editing directly the app/etc/env.php
, Magento should let anyone change the mode via the command line.
So my real question is: why is that mode here in the first place if we can never switch back to it, it's a clear lack of consistency in the software to me and I don't understand why it's there ?
To me and to bring consistency to the software, the team should either delete the default mode completely and ship with developer mode with debug/error messages turned off or either make the doc clearer : in which case should one use the default mode ? and let anyone switch back to it.