aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/FrontController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-31 14:45:37 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-31 14:45:37 +0100
commita97bbd9bd54c5fa56d54b3c214cf4e8af96af8b2 (patch)
tree6e83890bc1b3814a12c3b7bedc0d5944f30f507b /lib/Minz/FrontController.php
parent42fd539a1b14f883077048a35864b4294b6efe94 (diff)
parente91b72b63cd11ae3c4f59e48439e93955242c673 (diff)
Merge branch 'dev'
Conflicts: CHANGELOG README.fr.md README.md app/Controllers/feedController.php app/Controllers/indexController.php app/i18n/en.php app/i18n/fr.php app/views/helpers/view/normal_view.phtml app/views/stats/index.phtml app/views/stats/repartition.phtml constants.php p/scripts/main.js
Diffstat (limited to 'lib/Minz/FrontController.php')
-rw-r--r--lib/Minz/FrontController.php34
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php
index f13882801..f9eff3db6 100644
--- a/lib/Minz/FrontController.php
+++ b/lib/Minz/FrontController.php
@@ -30,14 +30,13 @@ class Minz_FrontController {
* Initialise le dispatcher, met à jour la Request
*/
public function __construct () {
- if (LOG_PATH === false) {
- $this->killApp ('Path not found: LOG_PATH');
- }
-
try {
- Minz_Configuration::init ();
+ Minz_Configuration::register('system',
+ DATA_PATH . '/config.php',
+ DATA_PATH . '/config.default.php');
+ $this->setReporting();
- Minz_Request::init ();
+ Minz_Request::init();
$url = $this->buildUrl();
$url['params'] = array_merge (
@@ -46,7 +45,7 @@ class Minz_FrontController {
);
Minz_Request::forward ($url);
} catch (Minz_Exception $e) {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
+ Minz_Log::error($e->getMessage());
$this->killApp ($e->getMessage ());
}
@@ -85,7 +84,7 @@ class Minz_FrontController {
$this->dispatcher->run();
} catch (Minz_Exception $e) {
try {
- Minz_Log::record ($e->getMessage (), Minz_Log::ERROR);
+ Minz_Log::error($e->getMessage());
} catch (Minz_PermissionDeniedException $e) {
$this->killApp ($e->getMessage ());
}
@@ -114,4 +113,23 @@ class Minz_FrontController {
}
exit ('### Application problem ###<br />'."\n".$txt);
}
+
+ private function setReporting() {
+ $conf = Minz_Configuration::get('system');
+ switch($conf->environment) {
+ case 'production':
+ error_reporting(E_ALL);
+ ini_set('display_errors','Off');
+ ini_set('log_errors', 'On');
+ break;
+ case 'development':
+ error_reporting(E_ALL);
+ ini_set('display_errors','On');
+ ini_set('log_errors', 'On');
+ break;
+ case 'silent':
+ error_reporting(0);
+ break;
+ }
+ }
}