Advertisement
phpaddict

CodeIgniter don't error log rmdir, unlink, chmod, etc

Jul 9th, 2014
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. // create MY_Log.php in folder application/libraries
  2. <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  3.  
  4. class MY_Log extends CI_Log
  5. {
  6.     public function write_log($level = 'error', $msg, $php_error = FALSE)
  7.     {
  8.         // strings that will not be saved in error log file
  9.         $blacklist = array(
  10.             'Severity: Warning  --> rmdir(',
  11.             'Severity: Warning  --> unlink(',
  12.             'Severity: Warning  --> chmod() ['
  13.         );
  14.  
  15.         foreach ($blacklist as $str)
  16.         {
  17.             if (strpos($msg, $str) !== FALSE)
  18.             {
  19.                 return TRUE;
  20.             }
  21.         }
  22.  
  23.         parent::write_log($level, $msg, $php_error);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement