Add more test cases for bug 289
[mediawiki.git] / extensions / ShowProcesslist.php
blob1ee9d4016a74d69c31aee5a6a1ac3f83dbe6f2df
1 <?php
3 $wgExtensionFunctions[] = "wfShowProcesslist";
5 function wfShowProcesslist() {
7 require_once( 'includes/SpecialPage.php' );
9 class ShowProcesslistPage extends UnlistedSpecialPage
11 function ShowProcesslistPage() {
12 UnlistedSpecialPage::UnlistedSpecialPage("ShowProcesslist");
15 function execute( $par ) {
16 global $wgRequest, $wgOut, $wgTitle, $wgUser;
18 $this->setHeaders();
19 if ( !$wgUser->isDeveloper() ) {
20 $wgOut->addWikiText( "You're not allowed, go away" );
21 return;
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>";
33 $output .= "</tr>";
35 $output .= "</table>";
36 $wgOut->addHTML( $output );
41 SpecialPage::addPage( new ShowProcesslistPage );
43 } # End of extension function