Poll: Would you find a globally enabled profiler helpful?
You do not have permission to vote in this poll.
Yes, I would like to see a global switch for enabling the profiler
57.14%
8 57.14%
No, it is fine as it is.
42.86%
6 42.86%
Total 14 vote(s) 100%
* You voted for this item. [Show Results]

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enable profiler globally

#2
I'm not sure I understand what you're looking for. As far as I know, the code you included already works fine. In fact, I have a method in my base controller which does this.


PHP Code:
   protected function showProfiler($frontEnd true)
 
   {
 
       // $this->input->is_cli_request() is deprecated in CI 3.0, but the replacement
 
       // common is_cli() function is not available in CI 2.2.
 
       $isCliRequest substr(CI_VERSION01) == '2' $this->input->is_cli_request() : is_cli();
 
       if (! $isCliRequest
            
&& ! $this->input->is_ajax_request()
 
       ) {
 
           if ($frontEnd == false
                
|| $this->settings_lib->item('site.show_front_profiler')
 
           ) {
 
               $this->load->library('Console');
 
               $this->output->enable_profiler(true);
 
           }
 
       }
 
   

Then I call the method in my base controller's constructor based on the ENVIRONMENT. My admin controller passes false to the method to bypass the check against the site.show_front_profiler setting.

Obviously, some of this code isn't going to work in a base CI installation without the appropriate libraries, but the basic idea should still work.
Reply


Messages In This Thread
Enable profiler globally - by PaulD - 04-29-2015, 02:56 AM
RE: Enable profiler globally - by mwhitney - 04-29-2015, 06:40 AM
RE: Enable profiler globally - by gadelat - 04-29-2015, 11:23 AM
RE: Enable profiler globally - by CroNiX - 04-29-2015, 01:46 PM
RE: Enable profiler globally - by gadelat - 04-29-2015, 01:50 PM
RE: Enable profiler globally - by PaulD - 04-29-2015, 01:58 PM
RE: Enable profiler globally - by ivantcholakov - 04-29-2015, 03:32 PM
RE: Enable profiler globally - by ivantcholakov - 04-29-2015, 03:36 PM
RE: Enable profiler globally - by ivantcholakov - 04-29-2015, 04:38 PM
RE: Enable profiler globally - by InsiteFX - 04-29-2015, 06:07 PM
RE: Enable profiler globally - by John_Betong - 04-29-2015, 07:22 PM
RE: Enable profiler globally - by PaulD - 04-30-2015, 05:17 AM
RE: Enable profiler globally - by PaulD - 04-30-2015, 05:15 AM
RE: Enable profiler globally - by ivantcholakov - 04-30-2015, 10:52 AM
RE: Enable profiler globally - by InsiteFX - 05-01-2015, 01:12 AM
RE: Enable profiler globally - by RWCH - 05-01-2015, 06:08 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.