- q('DELETE FROM `process` WHERE `pid` = %d', intval(getmypid()));
- }
-
- /**
- * @brief Returns a string with a callstack. Can be used for logging.
- *
- * @return string
- */
- function callstack($depth = 4) {
- $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $depth + 2);
-
- // We remove the first two items from the list since they contain data that we don't need.
- array_shift($trace);
- array_shift($trace);
-
- $callstack = array();
- foreach ($trace AS $func) {
- $callstack[] = $func['function'];
- }
-
- return implode(', ', $callstack);