Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2878,11 +2878,19 @@ |
2879 | 2879 | } |
2880 | 2880 | |
2881 | 2881 | /** |
2882 | | - * Return a string consisting all callers in stack, somewhat useful sometimes |
2883 | | - * for profiling specific points |
| 2882 | + * Return a string consisting of callers in the stack. Useful sometimes |
| 2883 | + * for profiling specific points. |
| 2884 | + * |
| 2885 | + * @param $limit The maximum depth of the stack frame to return, or false for |
| 2886 | + * the entire stack. |
2884 | 2887 | */ |
2885 | | -function wfGetAllCallers() { |
2886 | | - return implode('/', array_map('wfFormatStackFrame',array_reverse(wfDebugBacktrace()))); |
| 2888 | +function wfGetAllCallers( $limit = 3 ) { |
| 2889 | + $trace = array_reverse( wfDebugBacktrace() ); |
| 2890 | + if ( !$limit || $limit > count( $trace ) - 1 ) { |
| 2891 | + $limit = count( $trace ) - 1; |
| 2892 | + } |
| 2893 | + $trace = array_slice( $trace, -$limit - 1, $limit ); |
| 2894 | + return implode( '/', array_map( 'wfFormatStackFrame', $trace ) ); |
2887 | 2895 | } |
2888 | 2896 | |
2889 | 2897 | /** |