]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/plugin/AllPages.php
New debug argument for benchmarking. Returns the elapsed time to produce the list...
[SourceForge/phpwiki.git] / lib / plugin / AllPages.php
1 <?php // -*-php-*-
2 rcs_id('$Id: AllPages.php,v 1.9 2002-02-02 02:32:45 carstenklapp Exp $');
3
4 require_once('lib/PageList.php');
5
6 /**
7  */
8 class WikiPlugin_AllPages
9 extends WikiPlugin
10 {
11     function getName () {
12         return _("AllPages");
13     }
14
15     function getDescription () {
16         return _("All Pages");
17     }
18     
19     function getDefaultArguments() {
20         return array('noheader'      => false,
21                      'include_empty' => false,
22                      'exclude'       => '',
23                      'info'          => '',
24                      'debug'         => false
25                      );
26     }
27     // info arg allows multiple columns info=mtime,hits,summary,version,author,locked,minor
28     // exclude arg allows multiple pagenames exclude=HomePage,RecentChanges
29
30     function run($dbi, $argstr, $request) {
31         extract($this->getArgs($argstr, $request));
32
33         $pagelist = new PageList($info, $exclude);
34         if (!$noheader)
35             $pagelist->setCaption(_("Pages in this wiki (%d total):"));
36
37         if ($debug) $time_start = $this->getmicrotime();
38
39         $pagelist->addPages( $dbi->getAllPages($include_empty) );
40
41         if ($debug) $time_end = $this->getmicrotime();
42
43         if ($debug) {
44             $time = $time_end - $time_start;
45             return HTML::p(fmt("elapsed time: %s s", $time), $pagelist);
46         } else {
47             return $pagelist;
48         }
49     }
50
51     function getmicrotime(){ 
52         list($usec, $sec) = explode(" ",microtime()); 
53         return ((float)$usec + (float)$sec); 
54     } 
55 };
56         
57 // Local Variables:
58 // mode: php
59 // tab-width: 8
60 // c-basic-offset: 4
61 // c-hanging-comment-ender-p: nil
62 // indent-tabs-mode: nil
63 // End:   
64 ?>