Shave off a few more milliseconds from cleanUp() inner loop.
[mediawiki.git] / extensions / ShowProcesslist.php
blob23f159784ee9e4d875e71e3f9143e99b98223935
1 <?php
2 # Not a valid entry point, skip unless MEDIAWIKI is defined
3 if (defined('MEDIAWIKI')) {
5 $wgExtensionFunctions[] = "wfShowProcesslist";
7 function wfShowProcesslist() {
8 global $IP;
9 require_once( "$IP/includes/SpecialPage.php" );
11 class ShowProcesslistPage extends UnlistedSpecialPage
13 function ShowProcesslistPage() {
14 UnlistedSpecialPage::UnlistedSpecialPage("ShowProcesslist");
17 function execute( $par ) {
18 global $wgRequest, $wgOut, $wgTitle, $wgUser;
20 $this->setHeaders();
21 if ( !$wgUser->isDeveloper() ) {
22 $wgOut->addWikiText( "You're not allowed, go away" );
23 return;
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>";
35 $output .= "</tr>";
37 $output .= "</table>";
38 $wgOut->addHTML( $output );
43 SpecialPage::addPage( new ShowProcesslistPage );
45 } # End of extension function
46 } # End of invocation guard