/** * @param bool $showHeader * @param bool $logFile * @return null|string */ function getShellPs($showHeader = false, $logFile = false) { if (!debug_allow()) { return null; } $h = $showHeader === true ? '' : 'h'; $log = $logFile === false ? '' : ' >> ' . $logFile; return shell_exec('ps ' . $h . 'p ' . getmypid() . ' o time,pcpu,pmem,rss,lastcpu' . $log); }
/** * @param mixed $tab * @param mixed ... */ function debug_full($tab) { if (!debug_allow()) { return; } $trace = backtrace(1); if (!isCLI()) { write("<pre style='background-color: #efefef; border: 1px solid #aaaaaa; color:#000;'>"); $traceFile = backtrace(); $fFile = array_key_exists('file', $traceFile[0]) ? $traceFile[0]['file'] : '???'; $fLine = array_key_exists('line', $traceFile[0]) ? $traceFile[0]['line'] : '???'; $f = "{$fFile}:{$fLine}"; write("<div style='font-weight: bold; background-color: #FFF15F; border-bottom: 1px solid #aaaaaa;'><a href='http://localhost:8091?message={$f}'>{$f}</a></div>"); write("<hr>"); write(call_user_func_array('var_dump_human_full', func_get_args())); write("<hr>"); backtrace_print(0, $trace); write("</pre>"); } else { write("\n===== Debug Variable =====\n"); write(call_user_func_array('var_dump_human_full', func_get_args())); write("\n======= Debug Break =======\n"); backtrace_print(0, $trace); write("\n======= Exiting... ========\n"); } exit; }