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