wiki.techinc.nl/extensions/ShowProcesslist.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2004-09-26 06:45:30 +00:00
<?php
# Not a valid entry point, skip unless MEDIAWIKI is defined
if (defined('MEDIAWIKI')) {
2004-09-26 06:45:30 +00:00
$wgExtensionFunctions[] = "wfShowProcesslist";
function wfShowProcesslist() {
global $IP;
require_once( "$IP/includes/SpecialPage.php" );
2004-09-26 06:45:30 +00:00
class ShowProcesslistPage extends UnlistedSpecialPage
{
function ShowProcesslistPage() {
UnlistedSpecialPage::UnlistedSpecialPage("ShowProcesslist");
}
function execute( $par ) {
global $wgRequest, $wgOut, $wgTitle, $wgUser;
$this->setHeaders();
if ( !$wgUser->isDeveloper() ) {
$wgOut->addWikiText( "You're not allowed, go away" );
return;
}
$res=wfQuery("SHOW FULL PROCESSLIST",DB_READ);
$output=array();
2004-10-02 20:48:01 +00:00
$output = '<table border="1">';
2004-09-26 06:45:30 +00:00
while ( $row=wfFetchObject($res)){
$output .= "<tr>";
$fields = get_object_vars($row);
foreach ($fields as $name => $value ) {
$output .= "<td>" . htmlspecialchars( $value ) . "</td>";
}
$output .= "</tr>";
}
$output .= "</table>";
$wgOut->addHTML( $output );
}
}
SpecialPage::addPage( new ShowProcesslistPage );
} # End of extension function
} # End of invocation guard
2004-09-26 06:45:30 +00:00
?>