Last active
December 29, 2015 15:19
Revisions
-
GDmac revised this gist
Dec 31, 2013 . 1 changed file with 12 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,18 +18,18 @@ function get_caller_info() { $func = ''; $class = ''; $trace = debug_backtrace(); // if (isset($trace[2])) { // $file = $trace[1]['file']; // $line = $trace[1]['line']; // $func = $trace[2]['function']; // if ((substr($func, 0, 7) == 'include') || (substr($func, 0, 7) == 'require')) { // $func = ''; // } // } else if (isset($trace[1])) { // $file = $trace[1]['file']; // $line = $trace[1]['line']; // $func = ''; // } if (isset($trace[3]['class'])) { $class = $trace[3]['class']; $func = $trace[3]['function']; -
GDmac revised this gist
Nov 30, 2013 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,9 +10,7 @@ $this->queries[] = $sql . "\n# ".get_caller_info(); } // get_caller_info funtion somewhere in global scope function get_caller_info() { $c = ''; $file = ''; -
GDmac revised this gist
Nov 30, 2013 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,15 +4,14 @@ // database/DB_driver.php method query() //... // Save the query for debugging if ($this->save_queries == TRUE) { $this->queries[] = $sql . "\n# ".get_caller_info(); } // ... // add get_caller_info funtion somewhere in global scope function get_caller_info() { $c = ''; -
GDmac revised this gist
Nov 30, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ <?php // from http://php.net/manual/en/function.debug-backtrace.php#111255 // adapted for codeigniter -
GDmac revised this gist
Nov 30, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,9 +45,9 @@ function get_caller_info() { } if ($file != ''){ if (strpos($file,BASEPATH)===0) { $file = 'CI ' . str_replace(BASEPATH,'',$file); }elseif (strpos($file,APPPATH)===0) { $file = 'APP ' . str_replace(APPPATH,'',$file); }else { $file = 'UNKNOWN ' . basename($file); } -
GDmac revised this gist
Nov 30, 2013 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,18 @@ // from http://php.net/manual/en/function.debug-backtrace.php#111255 // adapted for codeigniter // database/DB_driver.php method query() //... // Save the query for debugging if ($this->save_queries == TRUE) { $this->queries[] = $sql . "\n# ".get_caller_info(); } // ... // add this funtion somewhere function get_caller_info() { $c = ''; $file = ''; -
GDmac revised this gist
Nov 30, 2013 . 1 changed file with 45 additions and 30 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,45 @@ function get_caller_info() { $c = ''; $file = ''; $line = ''; $func = ''; $class = ''; $trace = debug_backtrace(); if (isset($trace[2])) { $file = $trace[1]['file']; $line = $trace[1]['line']; $func = $trace[2]['function']; if ((substr($func, 0, 7) == 'include') || (substr($func, 0, 7) == 'require')) { $func = ''; } } else if (isset($trace[1])) { $file = $trace[1]['file']; $line = $trace[1]['line']; $func = ''; } if (isset($trace[3]['class'])) { $class = $trace[3]['class']; $func = $trace[3]['function']; $file = $trace[2]['file']; $line = $trace[2]['line']; } else if (isset($trace[2]['class'])) { $class = $trace[2]['class']; $func = $trace[2]['function']; $file = $trace[1]['file']; $line = $trace[1]['line']; } if ($file != ''){ if (strpos($file,BASEPATH)===0) { $file = 'CI ' . basename($file); }elseif (strpos($file,APPPATH)===0) { $file = 'APP ' . basename($file); }else { $file = 'UNKNOWN ' . basename($file); } } $c = $file . ": "; $c .= ($class != '') ? ":" . $class . "->" : ""; $c .= ($func != '') ? $func . "(): " : ""; $c .= ' Line: '.$line; return($c); } -
GDmac revised this gist
Nov 28, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ { $file = 'UNKNOWN : '.$callstack[1]['file']; } $file = "\n#".$file.' L:'.$callstack[1]['line']; } $this->queries[] = $sql . $file; -
GDmac revised this gist
Nov 28, 2013 . 1 changed file with 17 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,29 @@ // ... // Save the query for debugging if ($this->save_queries == TRUE) { // ADDED: Some backtracing $file = ''; $callstack = debug_backtrace(); if(count($callstack) >= 2) { //list($callee) = $callstack[1]; if (strpos($callstack[1]['file'], BASEPATH)===0) { $file = 'CI/'.str_replace(BASEPATH, '', $callstack[1]['file']); } elseif (strpos($callstack[1]['file'], APPPATH)===0) { $file = 'APP/'.str_replace(APPPATH, '', $callstack[1]['file']); } else { $file = 'UNKNOWN : '.$callstack[1]['file']; } $file = "\n#" . $file; } $this->queries[] = $sql . $file; -
GDmac created this gist
Nov 28, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ //... // Save the query for debugging if ($this->save_queries == TRUE) { // Some backtracing $file = ''; $callstack = debug_backtrace(); if(count($callstack) >= 2) { //list($callee) = $callstack[1]; if (strpos($callstack[1]['file'], BASEPATH)===0) { $file = 'CI/'.str_replace(BASEPATH, '', $callstack[1]['file']); } elseif (strpos($callstack[1]['file'], APPPATH)===0) { $file = 'APP/'.str_replace(APPPATH, '', $callstack[1]['file']); } else { $file = 'UNKNOWN : '.$callstack[1]['file']; } $file = "\n #" . $file; } $this->queries[] = $sql . $file; }