ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Working With Profiler ...in CI v 2.1.0

December 28, 2011 9:11am

Subscribe [0]
  • #1 / Dec 28, 2011 9:11am

    Vaibhav132

    14 posts

    I am trying to insert the output of the

    $this->output->enable_profiler(TRUE);

    into my own log file which i have created in application/logs/profiler.php

    I have done following steps for that

    1) config.php file

    $config[‘enable_hooks’] = TRUE;

    2)in hooks folder created hooks/profiler.php

    function profiler_hook(){
    
     if($_SERVER['REMOTE_ADDR'] == '127.0.0.1'){
      $CI =& get_instance();
      $CI->output->enable_profiler(TRUE);
      
     }
    }

    3)Created my own library called “my_profiler”.Copied the below code from libraries\Profiler.php

    class My_Profiler extends CI_Profiler {
     
     public function _run(){
     
      $output = "<div id='codeigniter_profiler'>";
      $fields_displayed = 0;
    
      foreach ($this->_available_sections as $section)
      {
       if ($this->_compile_{$section} !== FALSE)
       {
        $func = "_compile_{$section}";
        $output .= $this->{$func}();
        $fields_displayed++;
       }
      }
    
      if ($fields_displayed == 0)
      {
       $output .= ''.$this->CI->lang->line('profiler_no_profiles').'';
      }
    
      $output .= '</div>';
    
      file_put_contents( BASEPATH.'logs/profiler.php', $output);
      
      
                    //return $output;
                    return '';
    
    
      
     }
    }


    The ERROR !

    the $output is not written to the file
    logs/profiler.php

    It’s working for old version.
    Any Clue, Why it’s not working ?

     

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases