Fix for running without include_path set
[lhc/web/wiklou.git] / extensions / ShowProcesslist.php
1 <?php
2
3 $wgExtensionFunctions[] = "wfShowProcesslist";
4
5 function wfShowProcesslist() {
6
7 require_once( 'includes/SpecialPage.php' );
8
9 class ShowProcesslistPage extends UnlistedSpecialPage
10 {
11 function ShowProcesslistPage() {
12 UnlistedSpecialPage::UnlistedSpecialPage("ShowProcesslist");
13 }
14
15 function execute( $par ) {
16 global $wgRequest, $wgOut, $wgTitle, $wgUser;
17
18 $this->setHeaders();
19 if ( !$wgUser->isDeveloper() ) {
20 $wgOut->addWikiText( "You're not allowed, go away" );
21 return;
22 }
23
24 $res=wfQuery("SHOW FULL PROCESSLIST",DB_READ);
25 $output=array();
26 $output = "<table border=1>";
27 while ( $row=wfFetchObject($res)){
28 $output .= "<tr>";
29 $fields = get_object_vars($row);
30 foreach ($fields as $name => $value ) {
31 $output .= "<td>" . htmlspecialchars( $value ) . "</td>";
32 }
33 $output .= "</tr>";
34 }
35 $output .= "</table>";
36 $wgOut->addHTML( $output );
37
38 }
39 }
40
41 SpecialPage::addPage( new ShowProcesslistPage );
42
43 } # End of extension function
44 ?>