2 rcs_id('$Id: _BackendInfo.php,v 1.10 2002-01-22 03:17:47 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' => false);
22 function run($dbi, $argstr, $request) {
23 $args = $this->getArgs($argstr, $request);
28 $backend = &$dbi->_backend;
30 $html[] = HTML::h3(fmt("Querying backend directly for '%s'", $page));
33 $table = HTML::table(array('border' => 1,
36 $pagedata = $backend->get_pagedata($page);
38 $html[] = HTML::p(fmt("No pagedata for %s", $page));
40 $table->pushContent($this->_showhash("get_pagedata('$page')",
44 for ($version = $backend->get_latest_version($page);
46 $version = $backend->get_previous_version($page, $version)) {
48 $vdata = $backend->get_versiondata($page, $version, true);
50 $content = &$vdata['%content'];
51 if ($content === true)
53 elseif (strlen($content) > 40)
54 $content = substr($content,0,40) . " ...";
56 $table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
57 $table->pushContent($this->_showhash("get_versiondata('$page',$version)",
65 function _showhash ($heading, $hash) {
66 $rows[] = HTML::tr(array('bgcolor' => "#ffcccc"),
67 HTML::td(array('colspan' => 2), $heading));
69 foreach ($hash as $key => $val)
70 $rows[] = HTML::tr(HTML::td(array('align' => 'right',
71 'bgcolor' => '#cccccc'),
73 HTML::td($val ? $val : NBSP));
78 // (c-file-style: "gnu")
83 // c-hanging-comment-ender-p: nil
84 // indent-tabs-mode: nil