Magento2: Why can't one switch back to default mode ?

Created on 25 Apr 2016  路  9Comments  路  Source: magento/magento2

Steps to reproduce

  1. Install Magento from develop branch.
  2. Switch to developer mode php bin/magento deploy:mode:set developer
  3. Switch to default mode php bin/magento deploy:mode:set default

    Expected result

  4. Mode switched back to default

    Actual result

  5. 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.

Frontend Fixed in 2.2.x Fixed in 2.3.x Confirmed Format is not valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x bug report

Most helpful comment

+1. There should be possibility of switching back to default mode. Because, when a developer developing the code, he/she will not put it in production mode; and 'developer' mode runs too slow, so the best choice will be going back to 'default' mode which is faster than developer mode (creates pub/static files, we clean them), sometimes easier during development.

All 9 comments

Thanks @digitalpianism for bringing this up. I support the suggestion to remove the default mode (and then just make the different levels of debug info configurable) as this lessens potential for confusion.

@digitalpianism @fooman thank you for your input, this is already been discussed internally in scope of story MAGETWO-52090.

+1. There should be possibility of switching back to default mode. Because, when a developer developing the code, he/she will not put it in production mode; and 'developer' mode runs too slow, so the best choice will be going back to 'default' mode which is faster than developer mode (creates pub/static files, we clean them), sometimes easier during development.

I clearly support the option to return to Default mode. The current situation forces people to stay in default mode other than changing to developer mode for certain tasks. Clearly production mode is no good for development, but in my experience developer mode is simply too slow. Default mode is already slow, but still much faster than developer mode.

@digitalpianism, thank you for your report.
We've created internal ticket(s) MAGETWO-84627 to track progress on the issue.

mageconf

@Etty thank you for joining. Please accept team invitation here and self-assign the issue.

Hi @digitalpianism. Thank you for your report.
The issue has been fixed in magento/magento2#12752 by @Etty in 2.2-develop branch
Related commit(s):

  • ba219b84c7fbf62825d1c35fd3a2ae73226955ac

The fix will be available with the upcoming patch release.

Hi @digitalpianism. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1195 by @nmalevanec in 2.3-develop branch
Related commit(s):

  • 39671901f124b1b065ad92d7d4d421228edc9485

The fix will be available with the upcoming patch release.

Was this page helpful?
0 / 5 - 0 ratings