diag.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php if (!defined('PmWiki')) exit();
  2. /* Copyright 2003-2005 Patrick R. Michaud (pmichaud@pobox.com)
  3. This file is part of PmWiki; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published
  5. by the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version. See pmwiki.php for full details.
  7. This file adds "?action=diag" and "?action=phpinfo" actions to PmWiki.
  8. This produces lots of diagnostic output that may be helpful to the
  9. software authors when debugging PmWiki or other scripts.
  10. */
  11. ini_set('track_errors','1');
  12. if ($action=='diag') {
  13. @session_start();
  14. header('Content-type: text/plain');
  15. print_r($GLOBALS);
  16. exit();
  17. }
  18. if ($action=='phpinfo') { phpinfo(); exit(); }
  19. function Ruleset() {
  20. global $MarkupTable;
  21. $out = '';
  22. BuildMarkupRules();
  23. foreach($MarkupTable as $id=>$m)
  24. $out .= sprintf("%-16s %-16s %-16s\n",$id,@$m['cmd'],@$m['seq']);
  25. return $out;
  26. }
  27. $HandleActions['ruleset'] = 'HandleRuleset';
  28. function HandleRuleset($pagename) {
  29. header("Content-type: text/plain");
  30. print Ruleset();
  31. }
  32. function DisplayStopWatch() {
  33. global $StopWatch;
  34. StopWatch('now');
  35. $out = "<pre>";
  36. foreach((array)$StopWatch as $k => $x) {
  37. $out .= "$x\n";
  38. }
  39. if (is_array($StopWatch)) array_pop($StopWatch);
  40. $out .= '</pre>';
  41. return $out;
  42. }
  43. $FmtP['/\\$StopWatch/e'] = 'DisplayStopWatch()';