Welcome Guest, Not a member yet? Register   Sign In
global profiling enable/disable
#3

[eluser]JoostV[/eluser]
It is good practise to set different settings for your development, staging and productions environments. I do this in index.php, but you can do it anywhere, as longs as it's early in the process. Could even create a hook for it, to make it nice & loosely coupled.
Code:
$rootpath = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR;
if (stristr($rootpath, 'C:\htdocs')) {
    define('C_ENV', 'development');
    error_reporting(E_ALL | E_STRICT);
}
elseif (stristr($rootpath, 'home/testuser/domains/example.com')) {
    define('C_ENV', 'staging');
    error_reporting(0);
}
else {
    define('C_ENV', 'production');
    error_reporting(0);
}

You can use this in your database config too, or anywhere for that matter.

config.php:
Code:
if (C_ENV == 'production') {
    $config['log_threshold'] = 1;
}
else {
    $config['log_threshold'] = 4;
}

database.php
Code:
if (C_ENV == 'development') {
    $active_group = 'development';
}
elseif (C_ENV == 'staging') {
    $active_group = 'staging';
}
else {
    $active_group = 'default';
}

My_Controller.php
Code:
if (C_ENV == 'development') {
    $this->output->enable_profiler(TRUE);
}


Messages In This Thread
global profiling enable/disable - by El Forum - 04-10-2010, 03:08 AM
global profiling enable/disable - by El Forum - 04-10-2010, 05:30 AM
global profiling enable/disable - by El Forum - 04-10-2010, 06:27 AM
global profiling enable/disable - by El Forum - 04-10-2010, 12:12 PM
global profiling enable/disable - by El Forum - 04-10-2010, 12:14 PM
global profiling enable/disable - by El Forum - 04-10-2010, 03:24 PM
global profiling enable/disable - by El Forum - 04-10-2010, 06:53 PM
global profiling enable/disable - by El Forum - 07-15-2011, 05:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB