Skip to content

Commit

Permalink
Improve Developer Mode (#1445)
Browse files Browse the repository at this point in the history
* Enable Developer Mode by default for bundled development environment using environment variable. Relocate switch to Mage.php to allow for CLI.

* Fix SvenSniff style error. ;)
  • Loading branch information
colinmollenhour committed Mar 11, 2021
1 parent 62de637 commit 08d41c2
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@
RewriteRule .* - [L,R=405]

<IfModule mod_setenvif.c>

############################################
## Enable Developer Mode based on OS environment variable

SetEnvIfExpr "osenv('MAGE_IS_DEVELOPER_MODE') == '1'" MAGE_IS_DEVELOPER_MODE=1

<IfModule mod_headers.c>

############################################
Expand Down
6 changes: 0 additions & 6 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
exit;
}

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

Mage::$headersSentThrowsException = false;
Mage::init('admin');
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_GLOBAL, Mage_Core_Model_App_Area::PART_EVENTS);
Expand Down
5 changes: 5 additions & 0 deletions app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@

Mage::register('original_include_path', get_include_path());

if (!empty($_SERVER['MAGE_IS_DEVELOPER_MODE']) || !empty($_ENV['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
}

/**
* Set include path
*/
Expand Down
2 changes: 2 additions & 0 deletions dev/openmage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ You can override some defaults using environment variables defined in a file tha
- `ADMIN_EMAIL`
- `ADMIN_USERNAME`
- `ADMIN_PASSWORD`
- `MAGE_IS_DEVELOPER_MODE`
- Set to 1 by default, set to 0 to disable

Wiping
---
Expand Down
1 change: 1 addition & 0 deletions dev/openmage/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
environment:
- ENABLE_SENDMAIL=true
- XDEBUG_CONFIG=remote_connect_back=1 remote_enable=1 idekey=phpstorm
- MAGE_IS_DEVELOPER_MODE=1
links:
- mysql

Expand Down
6 changes: 0 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

/* Store or website code */
Expand Down
6 changes: 0 additions & 6 deletions index.php.sample
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ require_once $mageFilename;

#Varien_Profiler::enable();

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
}

#ini_set('display_errors', 1);

umask(0);

$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
Expand Down

0 comments on commit 08d41c2

Please sign in to comment.