2 rcs_id('$Id: _BackendInfo.php,v 1.11 2002-01-28 01:01:27 dairiki Exp $');
3 require_once('lib/Template.php');
6 class WikiPlugin__BackendInfo
10 return _("DebugInfo");
13 function getDescription () {
14 return sprintf(_("Get debugging information for %s."),'[pagename]');
17 function getDefaultArguments() {
18 return array('page' => '[pagename]');
21 function run($dbi, $argstr, $request) {
22 $args = $this->getArgs($argstr, $request);
27 $backend = &$dbi->_backend;
29 $html[] = HTML::h3(fmt("Querying backend directly for '%s'", $page));
32 $table = HTML::table(array('border' => 1,
35 $pagedata = $backend->get_pagedata($page);
37 $html[] = HTML::p(fmt("No pagedata for %s", $page));
39 $table->pushContent($this->_showhash("get_pagedata('$page')",
43 for ($version = $backend->get_latest_version($page);
45 $version = $backend->get_previous_version($page, $version)) {
47 $vdata = $backend->get_versiondata($page, $version, true);
49 $content = &$vdata['%content'];
50 if ($content === true)
52 elseif (strlen($content) > 40)
53 $content = substr($content,0,40) . " ...";
55 $table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
56 $table->pushContent($this->_showhash("get_versiondata('$page',$version)",
64 function _showhash ($heading, $hash) {
65 $rows[] = HTML::tr(array('bgcolor' => "#ffcccc"),
66 HTML::td(array('colspan' => 2), $heading));
68 foreach ($hash as $key => $val)
69 $rows[] = HTML::tr(HTML::td(array('align' => 'right',
70 'bgcolor' => '#cccccc'),
72 HTML::td($val ? $val : NBSP));
77 // (c-file-style: "gnu")
82 // c-hanging-comment-ender-p: nil
83 // indent-tabs-mode: nil