Skip to content

Why can't one switch back to default mode ? #4292

Closed
@digitalpianism

Description

@digitalpianism

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

  1. Mode switched back to default

Actual result

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

Metadata

Metadata

Assignees

Labels

Area: FrontendFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions