+++ /dev/null
-<?php
-
-$wgExtensionFunctions[] = "wfMakeDBErrorExt";
-
-function wfMakeDBErrorExt() {
-
-require_once( "includes/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
-
-?>
+++ /dev/null
-<?php
-# Not a valid entry point, skip unless MEDIAWIKI is defined
-if (defined('MEDIAWIKI')) {
-
-$wgExtensionFunctions[] = "wfShowProcesslist";
-
-function wfShowProcesslist() {
-global $IP;
-require_once( "$IP/includes/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
-} # End of invocation guard
-?>
+++ /dev/null
-<?php
-
-# Make an HTML table showing all the wikis on the site
-
-# Not a valid entry point, skip unless MEDIAWIKI is defined
-if (defined('MEDIAWIKI')) {
-
-$wgExtensionFunctions[] = "wfSiteMatrix";
-
-function wfSiteMatrix() {
-global $IP;
-require_once( "$IP/includes/SpecialPage.php" );
-
-class SiteMatrixPage extends SpecialPage
-{
- function SiteMatrixPage() {
- SpecialPage::SpecialPage("SiteMatrix");
- }
-
- function execute( $par ) {
- global $wgRequest, $wgOut, $wgTitle, $wgLocalDatabases;
- $this->setHeaders();
-
- $langlist = array_map( 'trim', file( '/home/wikipedia/common/langlist' ) );
- sort( $langlist );
- $xLanglist = array_flip( $langlist );
-
- $sites = array( 'wiki', 'wiktionary', 'wikibooks', 'wikiquote' );
- $names = array(
- 'wiki' => 'Wikipedia<br />w',
- 'wiktionary' => 'Wiktionary<br />wikt',
- 'wikibooks' => 'Wikibooks<br />b',
- 'wikiquote' => 'Wikiquote<br />q'
- );
- $hosts = array(
- 'wiki' => 'wikipedia.org',
- 'wiktionary' => 'wiktionary.org',
- 'wikibooks' => 'wikibooks.org',
- 'wikiquote' => 'wikiquote.org'
- );
-
- # Tabulate the matrix
- $specials = array();
- $matrix = array();
- foreach( $wgLocalDatabases as $db ) {
- # Find suffix
- foreach ( $sites as $site ) {
- if ( preg_match( "/(.*)$site\$/", $db, $m ) ) {
- $lang = $m[1];
- if ( empty( $xLanglist[$lang] ) && $site == 'wiki' ) {
- $specials[] = $lang;
- } else {
- $matrix[$site][$lang] = 1;
- }
- break;
- }
- }
- }
-
- # Construct the HTML
-
- # Header row
- $s = "<table><tr>";
- foreach ( $names as $name ) {
- $s .= "<td><strong>$name</strong></td>";
- }
- $s .= "</tr>\n";
-
- # Bulk of table
- foreach ( $langlist as $lang ) {
- $s .= "<tr>";
- foreach ( $names as $site => $name ) {
- $url = "http://$lang." . $hosts[$site] . "/";
- if ( empty( $matrix[$site][$lang] ) ) {
- # Non-existent wiki
- $s .= "<td><a href=\"$url\" class=\"new\">$lang</a></td>";
- } else {
- # Wiki exists
- $s .= "<td><a href=\"$url\">$lang</a></td>";
- }
- }
- $s .= "</tr>\n";
- }
- $s .= "</table>\n";
-
- # Specials
- $s .= "<ul>";
- foreach ( $specials as $lang ) {
- $s .= "<li><a href=\"http://$lang.wikipedia.org/\">$lang</a></li>\n";
- }
- $s .= "</ul>";
- $wgOut->addHTML( $s );
- }
-}
-
-SpecialPage::addPage( new SiteMatrixPage );
-global $wgMessageCache;
-$wgMessageCache->addMessage( "sitematrix", "List of Wikimedia wikis" );
-
-} # End of extension function
-} # End of invocation protection
-?>
+++ /dev/null
-<?php
-
-# This is a simple example of a special page module
-# Given a string in UTF-8, it converts it to HTML entities suitable for
-# an ISO 8859-1 web page.
-
-# Not a valid entry point, skip unless MEDIAWIKI is defined
-if (defined('MEDIAWIKI')) {
-$wgExtensionFunctions[] = "wfUnicodeConverter";
-
-function wfUnicodeConverter() {
-global $IP;
-require_once( "$IP/includes/SpecialPage.php" );
-
-class UnicodeConverter extends SpecialPage
-{
- function UnicodeConverter() {
- SpecialPage::SpecialPage("UnicodeConverter");
- }
-
- function execute( $par ) {
- global $wgRequest, $wgOut, $wgTitle;
-
- $this->setHeaders();
-
- $q = $wgRequest->getText( 'q' );
- $encQ = htmlspecialchars( $q );
- $action = $wgTitle->escapeLocalUrl();
- $ok = htmlspecialchars( wfMsg( "ok" ) );
-
- $wgOut->addHTML( <<<END
-<form name="ucf" method="post" action="$action">
-<textarea rows="15" cols="80" name="q">$encQ</textarea><br />
-<input type="submit" name="submit" value="$ok" /><br /><br />
-</form>
-END
-);
-
- if ( !is_null( $q ) ) {
- $html = wfUtf8ToHTML( htmlspecialchars( $q ) );
- $wgOut->addHTML( "\n\n\n" . nl2br( $html ) . "\n<hr />\n" .
- nl2br( htmlspecialchars( $html ) ) . "\n\n" );
- }
- }
-}
-
-global $wgMessageCache;
-SpecialPage::addPage( new UnicodeConverter );
-$wgMessageCache->addMessage( "unicodeconverter", "Unicode Converter" );
-
-} # End of extension function
-} # End of invocation guard
-?>