Extensions for testing and debugging
authorTim Starling <tstarling@users.mediawiki.org>
Sun, 26 Sep 2004 06:45:30 +0000 (06:45 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Sun, 26 Sep 2004 06:45:30 +0000 (06:45 +0000)
extensions/MakeDBError.php [new file with mode: 0644]
extensions/ShowProcesslist.php [new file with mode: 0644]
extensions/UnicodeConverter.php

diff --git a/extensions/MakeDBError.php b/extensions/MakeDBError.php
new file mode 100644 (file)
index 0000000..b6bb589
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+$wgExtensionFunctions[] = "wfMakeDBErrorExt";
+
+function wfMakeDBErrorExt() {
+
+require_once( "SpecialPage.php" );
+
+class MakeDBErrorPage extends UnlistedSpecialPage
+{
+       function MakeDBErrorPage() {
+               UnlistedSpecialPage::UnlistedSpecialPage("MakeDBError");
+       }
+
+       function execute( $par ) {
+               $this->setHeaders();
+               wfQuery( "test", DB_READ );
+       }
+}
+
+SpecialPage::addPage( new MakeDBErrorPage );
+
+} # End of extension function
+
+?>
diff --git a/extensions/ShowProcesslist.php b/extensions/ShowProcesslist.php
new file mode 100644 (file)
index 0000000..14f7d6e
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+$wgExtensionFunctions[] = "wfShowProcesslist";
+
+function wfShowProcesslist() {
+
+require_once( 'SpecialPage.php' );
+
+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();
+               $output = "<table border=1>";
+               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
+?>
index b146db3..44cc706 100644 (file)
@@ -7,6 +7,9 @@
 $wgExtensionFunctions[] = "wfUnicodeConverter";
 
 function wfUnicodeConverter() {
+
+require_once( "SpecialPage.php" );
+
 class UnicodeConverter extends SpecialPage
 {
        function UnicodeConverter() {