diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-12-15 18:02:47 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-12-15 18:02:47 +0100 |
commit | 396b28f3d881f5debd888ba9bb9b47c2d478a76f (patch) | |
tree | 10d6e1a721ee4ef69def34a57f02d7eb3fc9e31e /maintenance | |
parent | 0be4d3ccf6c4fe98a72704f9463ecdea2ee5e615 (diff) |
update to Mediawiki 1.13.3; some cleanups
Diffstat (limited to 'maintenance')
54 files changed, 7 insertions, 10045 deletions
diff --git a/maintenance/InitialiseMessages.inc b/maintenance/InitialiseMessages.inc deleted file mode 100644 index 22e26b94..00000000 --- a/maintenance/InitialiseMessages.inc +++ /dev/null @@ -1,257 +0,0 @@ -<?php -/** - * Script to initialise the MediaWiki namespace - * - * This script is included from update.php and install.php. Do not run it - * by itself. - * - * @deprecated - * @package MediaWiki - * @subpackage Maintenance - */ - -/** */ -function initialiseMessages( $overwrite = false, $messageArray = false, $outputCallback = false ) { - global $wgContLang, $wgContLanguageCode; - global $wgContLangClass; - global $wgDisableLangConversion; - global $wgForceUIMsgAsContentMsg; - global $wgLanguageNames; - global $IP; - - # overwrite language conversion option so that all variants - # of the messages are initialised - $wgDisableLangConversion = false; - - if ( $messageArray ) { - $sortedArray = $messageArray; - } else { - $sortedArray = Language::getMessagesFor( 'en' ); - } - - ksort( $sortedArray ); - $messages=array(); - - $variants = $wgContLang->getVariants(); - if(!in_array($wgContLanguageCode, $variants)) - $variants[]=$wgContLanguageCode; - - foreach ($variants as $v) { - $lang = Language::factory( $v ); - - if($v==$wgContLanguageCode) - $suffix=''; - else - $suffix="/$v"; - foreach ($sortedArray as $key => $msg) { - $messages[$key.$suffix] = $lang->getMessage($key); - } - } - - require_once('languages/Names.php'); - - /* - initialize all messages in $wgForceUIMsgAsContentMsg for all - languages in Names.php - */ - if( is_array( $wgForceUIMsgAsContentMsg ) ) { - foreach( $wgForceUIMsgAsContentMsg as $uikey ) { - foreach( $wgLanguageNames as $code => $name) { - if( $code == $wgContLanguageCode ) - continue; - $msg = $wgContLang->getMessage( $uikey ); - if( $msg ) - $messages[$uikey. '/' . $code] = $msg; - } - } - } - initialiseMessagesReal( $overwrite, $messages, $outputCallback ); -} - -/** */ -function initialiseMessagesReal( $overwrite = false, $messageArray = false, $outputCallback = false ) { - global $wgContLang, $wgScript, $wgServer, $wgLanguageCode; - global $wgOut, $wgArticle, $wgUser; - global $wgMessageCache, $wgMemc, $wgUseMemCached; - - # Initialise $wgOut and $wgUser for a command line script - $wgOut->disable(); - - $wgUser = new User; - $wgUser->setLoaded( true ); # Don't load from DB - $wgUser->setName( 'MediaWiki default' ); - - # Don't try to draw messages from the database we're initialising - $wgMessageCache->disable(); - $wgMessageCache->disableTransform(); - - $fname = 'initialiseMessages'; - $ns = NS_MEDIAWIKI; - # username responsible for the modifications - # Don't change it unless you're prepared to update the DBs accordingly, otherwise the - # default messages won't be overwritten - $username = 'MediaWiki default'; - - if ( !$outputCallback ) { - # Print is not a function, and there doesn't appear to be any built-in - # workalikes, so let's just make our own anonymous function to do the - # same thing. - $outputCallback = create_function( '$s', 'print $s;' ); - } - - $outputCallback( "Initialising \"MediaWiki\" namespace for language code $wgLanguageCode...\n" ); - - # Check that the serialized data files are OK - if ( Language::isLocalisationOutOfDate( $wgLanguageCode ) ) { - $outputCallback( "Warning: serialized data file may be out of date.\n" ); - } - - $dbr =& wfGetDB( DB_SLAVE ); - $dbw =& wfGetDB( DB_MASTER ); - $page = $dbr->tableName( 'page' ); - $revision = $dbr->tableName( 'revision' ); - - $timestamp = wfTimestampNow(); - - $first = true; - if ( $messageArray ) { - $sortedArray = $messageArray; - } else { - $sortedArray = $wgContLang->getAllMessages(); - } - - ksort( $sortedArray ); - - # SELECT all existing messages - # Can't afford to be locking all rows for update, this script can take quite a long time to complete - $rows = array(); - $nitems = count($sortedArray); - $maxitems = $dbr->maxListLen(); - $pos = 0; - if ($maxitems) - $chunks = array_chunk($sortedArray, $maxitems); - else - $chunks = array($sortedArray); - - foreach ($chunks as $chunk) { - $first = true; - $sql = "SELECT page_title,page_is_new,rev_user_text FROM $page, $revision WHERE - page_namespace=$ns AND rev_id=page_latest AND page_title IN("; - - foreach ( $chunk as $key => $enMsg ) { - if ( $key == '' ) { - continue; // Skip odd members - } - if ( $first ) { - $first = false; - } else { - $sql .= ','; - } - $titleObj = Title::newFromText( $wgContLang->ucfirst( $key ) ); - $enctitle = $dbr->strencode($titleObj->getDBkey()); - $sql .= "'$enctitle'"; - } - - $sql .= ')'; - $res = $dbr->query( $sql ); - while ($row = $dbr->fetchObject($res)) - $rows[] = $row; - } - - # Read the results into an array - # Decide whether or not each one needs to be overwritten - $existingTitles = array(); - foreach ($rows as $row) { - if ( $row->rev_user_text != $username && $row->rev_user_text != 'Template namespace initialisation script' ) { - $existingTitles[$row->page_title] = 'keep'; - } else { - $existingTitles[$row->page_title] = 'chuck'; - } - } - - # Insert queries are done in one multi-row insert - # Here's the start of it: - $arr = array(); - $talk = $wgContLang->getNsText( NS_TALK ); - $mwtalk = $wgContLang->getNsText( NS_MEDIAWIKI_TALK ); - - $numUpdated = 0; - $numKept = 0; - $numInserted = 0; - - # Merge these into a single transaction for speed - $dbw->begin(); - - # Process each message - foreach ( $sortedArray as $key => $message ) { - if ( $key == '' ) { - continue; // Skip odd members - } - # Get message text - if ( !$messageArray ) { - $message = wfMsgNoDBForContent( $key ); - } - if ( is_null( $message ) ) { - # This happens sometimes with out of date serialized data files - $outputCallback( "Warning: Skipping null message $key\n" ); - continue; - } - - $titleObj = Title::newFromText( $wgContLang->ucfirst( $key ), NS_MEDIAWIKI ); - $title = $titleObj->getDBkey(); - - # Update messages which already exist - if ( array_key_exists( $title, $existingTitles ) ) { - if ( $existingTitles[$title] == 'chuck' || $overwrite) { - # Don't bother writing a new revision if we're the same - # as the current text! - $revision = Revision::newFromTitle( $titleObj ); - if( is_null( $revision ) || $revision->getText() != $message ) { - $article = new Article( $titleObj ); - $article->quickEdit( $message ); - ++$numUpdated; - } else { - ++$numKept; - } - } else { - ++$numKept; - } - } else { - $article = new Article( $titleObj ); - $newid = $article->insertOn( $dbw ); - # FIXME: set restrictions - $revision = new Revision( array( - 'page' => $newid, - 'text' => $message, - 'user' => 0, - 'user_text' => $username, - 'comment' => '', - ) ); - $revid = $revision->insertOn( $dbw ); - $article->updateRevisionOn( $dbw, $revision ); - ++$numInserted; - } - } - $dbw->commit(); - - # Clear the relevant memcached key - $wgMessageCache->clear(); - $outputCallback( "Done. Updated: $numUpdated, inserted: $numInserted, kept: $numKept.\n" ); -} - -/** */ -function loadLanguageFile( $filename ) { - $contents = file_get_contents( $filename ); - # Remove header line - $p = strpos( $contents, "\n" ) + 1; - $contents = substr( $contents, $p ); - # Unserialize - return unserialize( $contents ); -} - -/** */ -function doUpdates() { - global $wgDeferredUpdateList; - foreach ( $wgDeferredUpdateList as $up ) { $up->doUpdate(); } -} -?> diff --git a/maintenance/alltrans.php b/maintenance/alltrans.php deleted file mode 100644 index 2fdc4499..00000000 --- a/maintenance/alltrans.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -/** - * @package MediaWiki - * @subpackage Maintenance - */ - -require_once('commandLine.inc'); - -foreach(array_keys($wgAllMessagesEn) as $key) - echo "$key\n"; -?> diff --git a/maintenance/archives/patch-list.txt b/maintenance/archives/patch-list.txt deleted file mode 100644 index 93a63bfd..00000000 --- a/maintenance/archives/patch-list.txt +++ /dev/null @@ -1,182 +0,0 @@ -List of database patches and upgrades as the PediaWiki software evolves... - -* 2002-11-23: Search index format changed for UTF-8 wikis -For wikis using the UTF-8 languages, the search index entries -need to be rebuild to allow searching to work. (Other wikis -that have been run through the old phase2->phase3 conversion -script should also be reindexed to catch apostrophe misplacement.) - -Run rebuildIndex.php on your wiki. - - - -* 2002-11-27: Watchlist format changed -Converts the user_watchlist entries out to a separate table which -links user_id<->cur_id and can be more handily queried. - -Run upgradeWatchlist.php on your wiki. - - - -* 2002-12-14: Recentchanges table bot/hidden column -Adds a column to indicate changes by registered bots (or perhaps -later other admin actions) that should be hidden from the default -Recentchanges list because people think they're tedious, but should -still be available in article histories, contribs lists, and -power-user RC lists. - -Run bot.sql against your database. - - - -* 2002-12-17: Watchlist format changed again -Now using namespace, title instead of cur_id. This can track deleted/ -recreated pages better, makes it easier to handle talk pages (now with -the auto-watch feature there's a lot more watching of talk pages!) -and whatnot. - -Run patch-watchlist.sql against your database. If all is well, drop -the oldwatchlist table which is no longer needed. (Note that this update -also drops the vestigial user_watchlist column.) - - - -* 2002-12-26: TeX math rendering adds 'math' table -A new 'math' table is used to cache TeX sections. - -Run patch-math.sql against your database, and add 'tmp' and 'math' -subdirectories to your tree alongside the upload directory, and copy -the 'math' source subdirectory under the wiki's PHP directory and run -"make" to compile the texvc evaluator. (whew!) - -TeX support requires TeX, OCaml, and ImageMagick. If you don't want -to use TeX support on your wiki, you can globally disable it by -setting $wgUseTeX=false in LocalSettings.php. - - - -* 2003-01-25: searchindex table -A new 'searchindex' table separates the fulltext index fields from -'cur'. This enables use of InnoDB tables, which don't support fulltext -search, for the main data, and will keep junk out of the backup dumps. - -Run patch-searchindex.sql on the database. If you wish to change table -tables on the others, use 'alter table' manually. (See MySQL docs.) - - -* 2003-01-24: Talk pages for anonymous users -A new table user_newtalk contains a list of talk pages that were -changed, both pages by anonymous and those by non-anonymous users. - -Run patch-usernewtalk.sql if your database was created before -this date. - - -* 2003-02-02: Math table changed -Rerun patch-math.sql to recreate it. - -* 2003-02-03: Index added to USER table for performance reasons. Run -patch-userindex.sql to create it. - - -* 2003-02-09: Random table & inverse timestamps -The random page queue table has been removed in favor of a column -in the cur table. This eliminates the ssllooww queue refill step; -pre-storing random indices in an indexed column means we can do the -random sort instantly; each element is re-randomized upon selection. - -Also, an inverse_timestamp field has been added to the cur and old -tables. This will allow fast index-based sorting in history lists, -user contribs, linked recentchanges, etc with MySQL 3, which doesn't -allow DESC ordering on an indexed field. This may be removed later -when MySQL is found to be stable. - - -* 2003-03-22: Last touched fields for caching -'Last touched' timestamp fields have been added to the cur and user -tables to aid in maintaining cache consistency. Web clients will -be forced to reload a page if it has been touched since the client's -cached copy (this will catch indirect changes like creation of -linked pages) or if a user changes preferences or logs in anew (so -visual changes and login status are taken into account). - -Run patch-cache.sql on the database to set these fields up. This is -required for changes to OutputPage.php and elsewhere to continue -working on an older database. - - -* 2003-05-23: Index for "Oldest articles" -"Oldest articles" needs an index on namespace, redirect and timestamp -to be reasonably fast. (patch-oldestindex.sql) - -OutputPage.php User.php maintenance/buildTables.inc maintenance/patch-cache.sql maintenance/patch-list.txt - -* 2003-09: Ipblocks auto-expiry update -patch-ipblocks.sql - -* Interwiki URL table -Moves the interwiki prefix<->url mapping table from a static array -into the database. If you've got a custom table, be sure to make -your changes! - -Run patch-interwiki.sql to create the interwiki table, then the -plain interwiki.sql to load up the default set of mappings. - -* 2003-05-30: File upload license fields -Adds fields to 'image' table. -INCOMPLETE, DO NOT USE - - -* 2003-08-21: Interwiki URL table -Moves the interwiki prefix<->url mapping table from a static array -into the database. If you've got a custom table, be sure to make -your changes! - -Run patch-interwiki.sql to create the interwiki table, then the -plain interwiki.sql to load up the default set of mappings. - -* 2003-09: Ipblocks auto-expiry update -patch-ipblocks.sql - -* Interwiki URL table -Moves the interwiki prefix<->url mapping table from a static array -into the database. If you've got a custom table, be sure to make -your changes! - -Run patch-interwiki.sql to create the interwiki table, then the -plain interwiki.sql to load up the default set of mappings. - -* 2003-11: Indexes -Fixes up indexes on links, brokenlinks, recentchanges, watchlist, -and archive tables to boost speed. - -Run patch-indexes.sql. - -* 2003-11: linkscc table creation -patch-linkscc.sql - - -* 2004-01-25: recentchanges additional index -Adds an index to recentchanges to optimize Special:Newpages -patch-rc-newindex.sql - -* 2004-02-14: Adds the ipb_expiry field to ipblocks -patch-ipb_expiry.sql - - -* 2004-03-11: Recreate links tables to avoid duplicating titles -everywhere. **Rebuild your links after this with refreshLinks.php** - -patch-linktables.sql - - -* 2004-04: Add user_real_name field -patch-user-realname.sql - -* 2004-05-08: Add querycache table for caching special pages and generic - object cache to cover some slow operations w/o memcached. -patch-querycache.sql -patch-objectcache.sql - -* 2004-05-14: Add categorylinks table for handling category membership -patch-categorylinks.sql diff --git a/maintenance/archives/patch-rename-group.sql b/maintenance/archives/patch-rename-group.sql deleted file mode 100644 index e69de29b..00000000 --- a/maintenance/archives/patch-rename-group.sql +++ /dev/null diff --git a/maintenance/archives/patch-userlevels-defaultgroups.sql b/maintenance/archives/patch-userlevels-defaultgroups.sql deleted file mode 100644 index e69de29b..00000000 --- a/maintenance/archives/patch-userlevels-defaultgroups.sql +++ /dev/null diff --git a/maintenance/archives/patch-userlevels-rights.sql b/maintenance/archives/patch-userlevels-rights.sql deleted file mode 100644 index e69de29b..00000000 --- a/maintenance/archives/patch-userlevels-rights.sql +++ /dev/null diff --git a/maintenance/archives/patch-usernewtalk2.sql b/maintenance/archives/patch-usernewtalk2.sql deleted file mode 100644 index e69de29b..00000000 --- a/maintenance/archives/patch-usernewtalk2.sql +++ /dev/null diff --git a/maintenance/build-intl-wiki.sql b/maintenance/build-intl-wiki.sql deleted file mode 100644 index f094c8b7..00000000 --- a/maintenance/build-intl-wiki.sql +++ /dev/null @@ -1,31 +0,0 @@ --- Experimental: create shared international database --- for new interlinking code. --- - -CREATE DATABASE intl; - -GRANT DELETE,INSERT,SELECT,UPDATE ON intl.* -TO wikiuser@'%' IDENTIFIED BY 'userpass'; -GRANT DELETE,INSERT,SELECT,UPDATE ON intl.* -TO wikiuser@localhost IDENTIFIED BY 'userpass'; -GRANT DELETE,INSERT,SELECT,UPDATE ON intl.* -TO wikiuser@localhost.localdomain IDENTIFIED BY 'userpass'; - -USE intl; - -CREATE TABLE ilinks ( - lang_from varchar(5) default NULL, - lang_to varchar(5) default NULL, - title_from tinyblob, - title_to tinyblob, - target_exists tinyint(1) default NULL -) TYPE=MyISAM; - -CREATE TABLE recentchanges ( - user_name tinyblob, - user_lang varchar(5) default NULL, - date timestamp(14) NOT NULL, - message tinyblob -) TYPE=MyISAM; - - diff --git a/maintenance/changeuser.sql b/maintenance/changeuser.sql deleted file mode 100644 index ad1c6da6..00000000 --- a/maintenance/changeuser.sql +++ /dev/null @@ -1,12 +0,0 @@ -set @oldname = 'At18'; -set @newname = 'Alfio'; - -update low_priority /*$wgDBprefix*/user set user_name=@newname where user_name=@oldname; -update low_priority /*$wgDBprefix*/user_newtalk set user_ip=@newname where user_ip=@oldname; -update low_priority /*$wgDBprefix*/cur set cur_user_text=@newname where cur_user_text=@oldname; -update low_priority /*$wgDBprefix*/old set old_user_text=@newname where old_user_text=@oldname; -update low_priority /*$wgDBprefix*/archive set ar_user_text=@newname where ar_user_text=@oldname; -update low_priority /*$wgDBprefix*/ipblocks set ipb_address=@newname where ipb_address=@oldname; -update low_priority /*$wgDBprefix*/oldimage set oi_user_text=@newname where oi_user_text=@oldname; -update low_priority /*$wgDBprefix*/recentchanges set rc_user_text=@newname where rc_user_text=@oldname; - diff --git a/maintenance/checktrans.php b/maintenance/checktrans.php deleted file mode 100644 index ebab4c7d..00000000 --- a/maintenance/checktrans.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * @package MediaWiki - * @subpackage Maintenance - * Check to see if all messages have been translated into the selected language. - * To run this script, you must have a working installation, and it checks the - * selected language of that installation. - */ - -/** */ -require_once('commandLine.inc'); - -if ( 'en' == $wgLanguageCode ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} - -$count = $total = 0; -$msgarray = 'wgAllMessages' . ucfirst( $wgLanguageCode ); - -foreach ( $wgAllMessagesEn as $code => $msg ) { - ++$total; - if ( ! array_key_exists( $code, $$msgarray ) ) { - print "'{$code}' => \"$msg\",\n"; - ++$count; - } -} - -print "{$count} messages of {$total} not translated.\n"; -?> diff --git a/maintenance/cleanupDupes.php b/maintenance/cleanupDupes.php deleted file mode 100644 index 4d87da46..00000000 --- a/maintenance/cleanupDupes.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -# Copyright (C) 2004 Brion Vibber <brion@pobox.com> -# http://www.mediawiki.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# http://www.gnu.org/copyleft/gpl.html - -/** - * If on the old non-unique indexes, check the cur table for duplicate - * entries and remove them... - * - * @addtogroup Maintenance - */ - -$options = array( 'fix', 'index' ); - -/** */ -require_once( 'commandLine.inc' ); -require_once( 'cleanupDupes.inc' ); -$wgTitle = Title::newFromText( 'Dupe cur entry cleanup script' ); - -checkDupes( isset( $options['fix'] ), isset( $options['index'] ) ); - -?> diff --git a/maintenance/database.sql b/maintenance/database.sql deleted file mode 100644 index dea99542..00000000 --- a/maintenance/database.sql +++ /dev/null @@ -1,7 +0,0 @@ --- SQL script to create database for wiki. This is run from --- the installation script which replaces the variables with --- their values from local settings. --- - -DROP DATABASE IF EXISTS `{$wgDBname}`; -CREATE DATABASE `{$wgDBname}`; diff --git a/maintenance/delete-idle-wiki-users.pl b/maintenance/delete-idle-wiki-users.pl deleted file mode 100644 index aef68ccd..00000000 --- a/maintenance/delete-idle-wiki-users.pl +++ /dev/null @@ -1,138 +0,0 @@ -#!/usr/bin/perl -# -# Nuke idle wiki accounts from the wiki's user database. -# -# Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED -# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -# NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 675 Mass Ave, Cambridge, MA 02139, USA. -# - -my $database = "DBI:mysql:database=wikidb;host=localhost"; -my $dbuser = "wikiuser"; -my $dbpasswd = "password"; - -use strict; -use DBI(); - -my $verbose = 0; -my $for_real = 1; - -sub do_db_op -{ - my ($dbh, $sql) = @_; - - if ($verbose >= 3) { - print $sql . ";\n" - } - - if ($for_real == 1) { - $dbh->do($sql); - } -} - -sub undo_user -{ - my ($ref, $dbh, $sth, $killed); - - # Connect to the database. - $dbh = DBI->connect($database, $dbuser, $dbpasswd, {RaiseError => 1}); - - $sth = $dbh->prepare("SELECT * FROM user"); - $sth->execute(); - - $ref = $sth->fetchrow_hashref(); - - if ($sth->rows == 0) { - print "There is no user in this wiki.\n"; - return; - } - - while ($ref = $sth->fetchrow_hashref()) { - my ($user_id, $user_name, $cph, $oph, $edits); - - $user_name = $ref->{user_name}; - $user_id = $ref->{user_id}; - if ($verbose >= 2) { - print "Annihilating user " . $user_name . - " has user_id " . $user_id . ".\n"; - } - - $cph = $dbh->prepare("SELECT * FROM cur where " . - "cur_user = $user_id" . - " AND " . - "cur_user_text = " . $dbh->quote("$user_name")); - $cph->execute(); - - $oph = $dbh->prepare("SELECT * FROM old where " . - "old_user = $user_id" . - " AND " . - "old_user_text = " . $dbh->quote("$user_name")); - $oph->execute(); - - $edits = $cph->rows + $oph->rows; - - $cph->finish(); - $oph->finish(); - - if ($edits == 0) { - if ($verbose >= 2) { - print "Keeping user " . $user_name . - ", user_id " . $user_id . ".\n"; - } - - do_db_op($dbh, - "DELETE FROM user WHERE user_name = " . - $dbh->quote("$user_name") . - " AND " . - "user_id = $user_id"); - - $killed++; - } - } - - $sth->finish(); - - $dbh->disconnect(); - - if ($verbose >= 1) { - print "Killed " . $killed . " users\n"; - } -} - -my (@users, $user, $this, $opts); - -@users = (); -$opts = 1; - -foreach $this (@ARGV) { - if ($opts == 1 && $this eq '-v') { - $verbose++; - } elsif ($opts == 1 && $this eq '--verbose') { - $verbose = 1; - } elsif ($opts == 1 && $this eq '--') { - $opts = 0; - } else { - push(@users, $this); - } -} - -undo_user(); - diff --git a/maintenance/diffLanguage.php b/maintenance/diffLanguage.php deleted file mode 100644 index eb87b3ba..00000000 --- a/maintenance/diffLanguage.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -# MediaWiki web-based config/installation -# Copyright (C) 2004 Ashar Voultoiz <thoane@altern.org> and others -# http://www.mediawiki.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# http://www.gnu.org/copyleft/gpl.html - -/** - * Usage: php DiffLanguage.php [lang [file]] - * - * lang: Enter the language code following "Language" of the LanguageXX.php you - * want to check. If using linux you might need to follow case aka Zh and not - * zh. - * - * file: A php language file you want to include to compare mediawiki - * Language{Lang}.php against (for example Special:Allmessages PHP output). - * - * The goal is to get a list of messages not yet localised in a languageXX.php - * file using the language.php file as reference. - * - * The script then print a list of wgAllMessagesXX keys that aren't localised, a - * percentage of messages correctly localised and the number of messages to be - * translated. - * - * @package MediaWiki - * @subpackage Maintenance - */ - -/** This script run from the commandline */ -require_once( 'parserTests.inc' ); -require_once( 'commandLine.inc' ); - -if( isset($options['help']) ) { usage(); wfDie(); } - -$wgLanguageCode = ucfirstlcrest($wgLanguageCode); -/** Language messages we will use as reference. By default 'en' */ -$referenceMessages = $wgAllMessagesEn; -$referenceLanguage = 'En'; -$referenceFilename = 'Language'.$referenceLanguage.'.php'; -/** Language messages we will test. */ -$testMessages = array(); -$testLanguage = ''; -/** whereas we use an external language file */ -$externalRef = false; - -# FUNCTIONS -/** @todo more informations !! */ -function usage() { -echo 'php DiffLanguage.php [lang [file]] [--color=(yes|no|light)]'."\n"; -} - -/** Return a given string with first letter upper case, the rest lowercase */ -function ucfirstlcrest($string) { - return strtoupper(substr($string,0,1)).strtolower(substr($string,1)); -} - -/** - * Return a $wgAllmessages array shipped in MediaWiki - * @param string $languageCode Formated language code - * @return array The MediaWiki default $wgAllMessages array requested - */ -function getMediawikiMessages($languageCode = 'En') { - - $foo = "wgAllMessages$languageCode"; - global $$foo, $wgSkinNamesEn; - - // it might already be loaded in LocalSettings.php - if(!isset($$foo)) { - global $IP; - $langFile = $IP.'/languages/Language'.$languageCode.'.php'; - if (file_exists( $langFile ) ) { - print "Including $langFile\n"; - global $wgNamespaceNamesEn; - include($langFile); - } else wfDie("ERROR: The file $langFile does not exist !\n"); - } - return $$foo; -} - -/** - * Return a $wgAllmessages array in a given file. Language of the array - * need to be given cause we can not detect which language it provides - * @param string $filename Filename of the file containing a message array - * @param string $languageCode Language of the external array - * @return array A $wgAllMessages array from an external file. - */ -function getExternalMessages($filename, $languageCode) { - print "Including external file $filename.\n"; - include($filename); - $foo = "wgAllMessages$languageCode"; - return $$foo; -} - -# MAIN ENTRY -if ( isset($args[0]) ) { - $lang = ucfirstlcrest($args[0],1); - - // eventually against another language file we will use as reference instead - // of the default english language. - if( isset($args[1])) { - // we assume the external file contain an array of messages for the - // lang we are testing - $referenceMessages = getExternalMessages( $args[1], $lang ); - $referenceLanguage = $lang; - $referenceFilename = $args[1]; - $externalRef = true; - } - - // Load datas from MediaWiki - $testMessages = getMediawikiMessages($lang); - $testLanguage = $lang; -} else { - usage(); - wfDie(); -} - -/** parsertest is used to do differences */ -$myParserTest =& new ParserTest(); - -# Get all references messages and check if they exist in the tested language -$i = 0; - -$msg = "MW Language{$testLanguage}.php against "; -if($externalRef) { $msg .= 'external file '; } -else { $msg .= 'internal file '; } -$msg .= $referenceFilename.' ('.$referenceLanguage."):\n----\n"; -echo $msg; - -// process messages -foreach($referenceMessages as $index => $ref) -{ - // message is not localized - if(!(isset($testMessages[$index]))) { - $i++; - print "'$index' => \"$ref\",\n"; - // Messages in the same language differs - } elseif( ($lang == $referenceLanguage) AND ($testMessages[$index] != $ref)) { - print "\n$index differs:\n"; - print $myParserTest->quickDiff($testMessages[$index],$ref,'tested','reference'); - } -} - -echo "\n----\n".$msg; -echo "$referenceLanguage language is complete at ".number_format((100 - $i/count($wgAllMessagesEn) * 100),2)."%\n"; -echo "$i unlocalised messages of the ".count($wgAllMessagesEn)." messages available.\n"; -?> diff --git a/maintenance/dumpHTML.inc b/maintenance/dumpHTML.inc deleted file mode 100644 index 18f5a9d7..00000000 --- a/maintenance/dumpHTML.inc +++ /dev/null @@ -1,1010 +0,0 @@ -<?php -/** - * @addtogroup Maintenance - */ - -define( 'REPORTING_INTERVAL', 10 ); - -require_once( 'includes/ImagePage.php' ); -require_once( 'includes/CategoryPage.php' ); -require_once( 'includes/RawPage.php' ); - -# Explicitly disable article view counter (bug 6823) -global $wgDisableCounters; -$wgDisableCounters = true; - -class DumpHTML { - # Destination directory - var $dest; - - # Skip existing files - var $noOverwrite = false; - - # Show interlanguage links? - var $interwiki = true; - - # Depth of HTML directory tree - var $depth = 3; - - # Directory that commons images are copied into - var $sharedStaticDirectory; - - # Directory that the images are in, after copying - var $destUploadDirectory; - - # Relative path to image directory - var $imageRel = 'upload'; - - # Copy commons images instead of symlinking - var $forceCopy = false; - - # Make a copy of all images encountered - var $makeSnapshot = false; - - # Don't image description pages in doEverything() - var $noSharedDesc = false; - - # Make links assuming the script path is in the same directory as - # the destination - var $alternateScriptPath = false; - - # Original values of various globals - var $oldArticlePath = false, $oldCopyrightIcon = false; - - # Has setupGlobals been called? - var $setupDone = false; - - # Has to compress html pages - var $compress = false; - - # List of raw pages used in the current article - var $rawPages; - - # Skin to use - var $skin = 'htmldump'; - - # Checkpoint stuff - var $checkpointFile = false, $checkpoints = false; - - var $startID = 1, $endID = false; - - var $sliceNumerator = 1, $sliceDenominator = 1; - - # Max page ID, lazy initialised - var $maxPageID = false; - - # UDP profiling - var $udpProfile, $udpProfileCounter = 0, $udpProfileInit = false; - - function DumpHTML( $settings = array() ) { - foreach ( $settings as $var => $value ) { - $this->$var = $value; - } - } - - function loadCheckpoints() { - if ( $this->checkpoints !== false ) { - return true; - } elseif ( !$this->checkpointFile ) { - return false; - } else { - $lines = @file( $this->checkpointFile ); - if ( $lines === false ) { - print "Starting new checkpoint file \"{$this->checkpointFile}\"\n"; - $this->checkpoints = array(); - } else { - $lines = array_map( 'trim', $lines ); - $this->checkpoints = array(); - foreach ( $lines as $line ) { - list( $name, $value ) = explode( '=', $line, 2 ); - $this->checkpoints[$name] = $value; - } - } - return true; - } - } - - function getCheckpoint( $type, $defValue = false ) { - if ( !$this->loadCheckpoints() ) { - return false; - } - if ( !isset( $this->checkpoints[$type] ) ) { - return false; - } else { - return $this->checkpoints[$type]; - } - } - - function setCheckpoint( $type, $value ) { - if ( !$this->checkpointFile ) { - return; - } - $this->checkpoints[$type] = $value; - $blob = ''; - foreach ( $this->checkpoints as $type => $value ) { - $blob .= "$type=$value\n"; - } - file_put_contents( $this->checkpointFile, $blob ); - } - - function doEverything() { - if ( $this->getCheckpoint( 'everything' ) == 'done' ) { - print "Checkpoint says everything is already done\n"; - return; - } - $this->doArticles(); - $this->doCategories(); - $this->doRedirects(); - if ( $this->sliceNumerator == 1 ) { - $this->doSpecials(); - } - $this->doLocalImageDescriptions(); - - if ( !$this->noSharedDesc ) { - $this->doSharedImageDescriptions(); - } - - $this->setCheckpoint( 'everything', 'done' ); - } - - /** - * Write a set of articles specified by start and end page_id - * Skip categories and images, they will be done separately - */ - function doArticles() { - if ( $this->endID === false ) { - $end = $this->getMaxPageID(); - } else { - $end = $this->endID; - } - $start = $this->startID; - - # Start from the checkpoint - $cp = $this->getCheckpoint( 'article' ); - if ( $cp == 'done' ) { - print "Articles already done\n"; - return; - } elseif ( $cp !== false ) { - $start = $cp; - print "Resuming article dump from checkpoint at page_id $start of $end\n"; - } else { - print "Starting from page_id $start of $end\n"; - } - - # Move the start point to the correct slice if it isn't there already - $start = $this->modSliceStart( $start ); - - $this->setupGlobals(); - - $mainPageObj = Title::newMainPage(); - $mainPage = $mainPageObj->getPrefixedDBkey(); - - for ( $id = $start, $i = 0; $id <= $end; $id += $this->sliceDenominator, $i++ ) { - wfWaitForSlaves( 20 ); - if ( !( $i % REPORTING_INTERVAL) ) { - print "Processing ID: $id\r"; - $this->setCheckpoint( 'article', $id ); - } - if ( !($i % (REPORTING_INTERVAL*10) ) ) { - print "\n"; - } - $title = Title::newFromID( $id ); - if ( $title ) { - $ns = $title->getNamespace() ; - if ( $ns != NS_CATEGORY && $ns != NS_MEDIAWIKI && - $title->getPrefixedDBkey() != $mainPage ) { - $this->doArticle( $title ); - } - } - } - $this->setCheckpoint( 'article', 'done' ); - print "\n"; - } - - function doSpecials() { - $this->doMainPage(); - - $this->setupGlobals(); - print "Special:Categories..."; - $this->doArticle( SpecialPage::getTitleFor( 'Categories' ) ); - print "\n"; - } - - /** Write the main page as index.html */ - function doMainPage() { - - print "Making index.html "; - - // Set up globals with no ../../.. in the link URLs - $this->setupGlobals( 0 ); - - $title = Title::newMainPage(); - $text = $this->getArticleHTML( $title ); - - # Parse the XHTML to find the images - $images = $this->findImages( $text ); - $this->copyImages( $images ); - - $file = fopen( "{$this->dest}/index.html", "w" ); - if ( !$file ) { - print "\nCan't open index.html for writing\n"; - return false; - } - fwrite( $file, $text ); - fclose( $file ); - print "\n"; - } - - function doImageDescriptions() { - $this->doLocalImageDescriptions(); - if ( !$this->noSharedDesc ) { - $this->doSharedImageDescriptions(); - } - } - - /** - * Dump image description pages that don't have an associated article, but do - * have a local image - */ - function doLocalImageDescriptions() { - $chunkSize = 1000; - - $dbr = wfGetDB( DB_SLAVE ); - - $cp = $this->getCheckpoint( 'local image' ); - if ( $cp == 'done' ) { - print "Local image descriptions already done\n"; - return; - } elseif ( $cp !== false ) { - print "Writing image description pages starting from $cp\n"; - $conds = array( 'img_name >= ' . $dbr->addQuotes( $cp ) ); - } else { - print "Writing image description pages for local images\n"; - $conds = false; - } - - $this->setupGlobals(); - $i = 0; - - do { - $res = $dbr->select( 'image', array( 'img_name' ), $conds, __METHOD__, - array( 'ORDER BY' => 'img_name', 'LIMIT' => $chunkSize ) ); - $numRows = $dbr->numRows( $res ); - - while ( $row = $dbr->fetchObject( $res ) ) { - # Update conds for the next chunk query - $conds = array( 'img_name > ' . $dbr->addQuotes( $row->img_name ) ); - - // Slice the result set with a filter - if ( !$this->sliceFilter( $row->img_name ) ) { - continue; - } - - wfWaitForSlaves( 10 ); - if ( !( ++$i % REPORTING_INTERVAL ) ) { - print "{$row->img_name}\n"; - if ( $row->img_name !== 'done' ) { - $this->setCheckpoint( 'local image', $row->img_name ); - } - } - $title = Title::makeTitle( NS_IMAGE, $row->img_name ); - if ( $title->getArticleID() ) { - // Already done by dumpHTML - continue; - } - $this->doArticle( $title ); - } - $dbr->freeResult( $res ); - } while ( $numRows ); - - $this->setCheckpoint( 'local image', 'done' ); - print "\n"; - } - - /** - * Dump images which only have a real description page on commons - */ - function doSharedImageDescriptions() { - list( $start, $end ) = $this->sliceRange( 0, 255 ); - - $cp = $this->getCheckpoint( 'shared image' ); - if ( $cp == 'done' ) { - print "Shared description pages already done\n"; - return; - } elseif ( $cp !== false ) { - print "Writing description pages for commons images starting from directory $cp/255\n"; - $start = $cp; - } else { - print "Writing description pages for commons images\n"; - } - - $this->setupGlobals(); - $i = 0; - for ( $hash = $start; $hash <= $end; $hash++ ) { - $this->setCheckpoint( 'shared image', $hash ); - - $dir = sprintf( "%s/%01x/%02x", $this->sharedStaticDirectory, - intval( $hash / 16 ), $hash ); - $handle = @opendir( $dir ); - while ( $handle && $file = readdir( $handle ) ) { - if ( $file[0] == '.' ) { - continue; - } - if ( !(++$i % REPORTING_INTERVAL ) ) { - print "$i\r"; - } - - $title = Title::makeTitleSafe( NS_IMAGE, $file ); - $this->doArticle( $title ); - } - if ( $handle ) { - closedir( $handle ); - } - } - $this->setCheckpoint( 'shared image', 'done' ); - print "\n"; - } - - function doCategories() { - $chunkSize = 1000; - - $this->setupGlobals(); - $dbr = wfGetDB( DB_SLAVE ); - - $cp = $this->getCheckpoint( 'category' ); - if ( $cp == 'done' ) { - print "Category pages already done\n"; - return; - } elseif ( $cp !== false ) { - print "Resuming category page dump from $cp\n"; - $conds = array( 'cl_to >= ' . $dbr->addQuotes( $cp ) ); - } else { - print "Starting category pages\n"; - $conds = false; - } - - $i = 0; - do { - $res = $dbr->select( 'categorylinks', 'DISTINCT cl_to', $conds, __METHOD__, - array( 'ORDER BY' => 'cl_to', 'LIMIT' => $chunkSize ) ); - $numRows = $dbr->numRows( $res ); - - while ( $row = $dbr->fetchObject( $res ) ) { - // Set conditions for next chunk - $conds = array( 'cl_to > ' . $dbr->addQuotes( $row->cl_to ) ); - - // Filter pages from other slices - if ( !$this->sliceFilter( $row->cl_to ) ) { - continue; - } - - wfWaitForSlaves( 10 ); - if ( !(++$i % REPORTING_INTERVAL ) ) { - print "{$row->cl_to}\n"; - if ( $row->cl_to != 'done' ) { - $this->setCheckpoint( 'category', $row->cl_to ); - } - } - $title = Title::makeTitle( NS_CATEGORY, $row->cl_to ); - $this->doArticle( $title ); - } - $dbr->freeResult( $res ); - } while ( $numRows ); - - $this->setCheckpoint( 'category', 'done' ); - print "\n"; - } - - function doRedirects() { - print "Doing redirects...\n"; - - $chunkSize = 10000; - $end = $this->getMaxPageID(); - $cp = $this->getCheckpoint( 'redirect' ); - if ( $cp == 'done' ) { - print "Redirects already done\n"; - return; - } elseif ( $cp !== false ) { - print "Resuming redirect generation from page_id $cp\n"; - $start = intval( $cp ); - } else { - $start = 1; - } - - $this->setupGlobals(); - $dbr = wfGetDB( DB_SLAVE ); - $i = 0; - - for ( $chunkStart = $start; $chunkStart <= $end; $chunkStart += $chunkSize ) { - $chunkEnd = min( $end, $chunkStart + $chunkSize - 1 ); - $conds = array( - 'page_is_redirect' => 1, - "page_id BETWEEN $chunkStart AND $chunkEnd" - ); - # Modulo slicing in SQL - if ( $this->sliceDenominator != 1 ) { - $n = intval( $this->sliceNumerator ); - $m = intval( $this->sliceDenominator ); - $conds[] = "page_id % $m = $n"; - } - $res = $dbr->select( 'page', array( 'page_id', 'page_namespace', 'page_title' ), - $conds, __METHOD__ ); - - while ( $row = $dbr->fetchObject( $res ) ) { - $title = Title::makeTitle( $row->page_namespace, $row->page_title ); - if ( !(++$i % (REPORTING_INTERVAL*10) ) ) { - printf( "Done %d redirects (%2.3f%%)\n", $i, $row->page_id / $end * 100 ); - $this->setCheckpoint( 'redirect', $row->page_id ); - } - $this->doArticle( $title ); - } - $dbr->freeResult( $res ); - } - $this->setCheckpoint( 'redirect', 'done' ); - } - - /** Write an article specified by title */ - function doArticle( $title ) { - if ( $this->noOverwrite ) { - $fileName = $this->dest.'/'.$this->getHashedFilename( $title ); - if ( file_exists( $fileName ) ) { - return; - } - } - - $this->profile(); - - $this->rawPages = array(); - $text = $this->getArticleHTML( $title ); - - if ( $text === false ) { - return; - } - - # Parse the XHTML to find the images - $images = $this->findImages( $text ); - $this->copyImages( $images ); - - # Write to file - $this->writeArticle( $title, $text ); - - # Do raw pages - wfMkdirParents( "{$this->dest}/raw", 0755 ); - foreach( $this->rawPages as $record ) { - list( $file, $title, $params ) = $record; - - $path = "{$this->dest}/raw/$file"; - if ( !file_exists( $path ) ) { - $article = new Article( $title ); - $request = new FauxRequest( $params ); - $rp = new RawPage( $article, $request ); - $text = $rp->getRawText(); - - print "Writing $file\n"; - $file = fopen( $path, 'w' ); - if ( !$file ) { - print("Can't open file $path for writing\n"); - continue; - } - fwrite( $file, $text ); - fclose( $file ); - } - } - - wfIncrStats( 'dumphtml_article' ); - } - - /** Write the given text to the file identified by the given title object */ - function writeArticle( $title, $text ) { - $filename = $this->getHashedFilename( $title ); - - # Temporary hack for current dump, this should be moved to - # getFriendlyName() at the earliest opportunity. - # - # Limit filename length to 255 characters, so it works on ext3. - # Titles are in fact limited to 255 characters, but dumpHTML - # adds a suffix which may put them over the limit. - $length = strlen( $filename ); - if ( $length > 255 ) { - print "Warning: Filename too long ($length bytes). Skipping.\n"; - return; - } - - $fullName = "{$this->dest}/$filename"; - $fullDir = dirname( $fullName ); - - if ( $this->compress ) { - $fullName .= ".gz"; - $text = gzencode( $text, 9 ); - } - - wfMkdirParents( $fullDir, 0755 ); - - wfSuppressWarnings(); - $file = fopen( $fullName, 'w' ); - wfRestoreWarnings(); - - if ( !$file ) { - die("Can't open file '$fullName' for writing.\nCheck permissions or use another destination (-d).\n"); - return; - } - - fwrite( $file, $text ); - fclose( $file ); - } - - /** Set up globals required for parsing */ - function setupGlobals( $currentDepth = NULL ) { - global $wgUser, $wgStylePath, $wgArticlePath, $wgMathPath; - global $wgUploadPath, $wgLogo, $wgMaxCredits, $wgSharedUploadPath; - global $wgHideInterlanguageLinks, $wgUploadDirectory, $wgThumbnailScriptPath; - global $wgSharedThumbnailScriptPath, $wgEnableParserCache, $wgHooks, $wgServer; - global $wgRightsUrl, $wgRightsText, $wgCopyrightIcon, $wgEnableSidebarCache; - global $wgGenerateThumbnailOnParse; - - static $oldLogo = NULL; - - if ( !$this->setupDone ) { - $wgHooks['GetLocalURL'][] =& $this; - $wgHooks['GetFullURL'][] =& $this; - $wgHooks['SiteNoticeBefore'][] =& $this; - $wgHooks['SiteNoticeAfter'][] =& $this; - $this->oldArticlePath = $wgServer . $wgArticlePath; - } - - if ( is_null( $currentDepth ) ) { - $currentDepth = $this->depth; - } - - if ( $this->alternateScriptPath ) { - if ( $currentDepth == 0 ) { - $wgScriptPath = '.'; - } else { - $wgScriptPath = '..' . str_repeat( '/..', $currentDepth - 1 ); - } - } else { - $wgScriptPath = '..' . str_repeat( '/..', $currentDepth ); - } - - $wgArticlePath = str_repeat( '../', $currentDepth ) . '$1'; - - # Logo image - # Allow for repeated setup - if ( !is_null( $oldLogo ) ) { - $wgLogo = $oldLogo; - } else { - $oldLogo = $wgLogo; - } - - if ( strpos( $wgLogo, $wgUploadPath ) === 0 ) { - # If it's in the upload directory, rewrite it to the new upload directory - $wgLogo = "$wgScriptPath/{$this->imageRel}/" . substr( $wgLogo, strlen( $wgUploadPath ) + 1 ); - } elseif ( $wgLogo{0} == '/' ) { - # This is basically heuristic - # Rewrite an absolute logo path to one relative to the the script path - $wgLogo = $wgScriptPath . $wgLogo; - } - - # Another ugly hack - if ( !$this->setupDone ) { - $this->oldCopyrightIcon = $wgCopyrightIcon; - } - $wgCopyrightIcon = str_replace( 'src="/images', - 'src="' . htmlspecialchars( $wgScriptPath ) . '/images', $this->oldCopyrightIcon ); - - $wgStylePath = "$wgScriptPath/skins"; - $wgUploadPath = "$wgScriptPath/{$this->imageRel}"; - $wgSharedUploadPath = "$wgUploadPath/shared"; - $wgMaxCredits = -1; - $wgHideInterlanguageLinks = !$this->interwiki; - $wgThumbnailScriptPath = $wgSharedThumbnailScriptPath = false; - $wgEnableParserCache = false; - $wgMathPath = "$wgScriptPath/math"; - $wgEnableSidebarCache = false; - $wgGenerateThumbnailOnParse = true; - - if ( !empty( $wgRightsText ) ) { - $wgRightsUrl = "$wgScriptPath/COPYING.html"; - } - - $wgUser = new User; - $wgUser->setOption( 'skin', $this->skin ); - $wgUser->setOption( 'editsection', 0 ); - - $this->destUploadDirectory = "{$this->dest}/{$this->imageRel}"; - if ( realpath( $this->destUploadDirectory ) == realpath( $wgUploadDirectory ) ) { - print "Disabling image snapshot because the destination is the same as the source\n"; - $this->makeSnapshot = false; - } - $this->sharedStaticDirectory = "{$this->destUploadDirectory}/shared"; - - $this->setupDone = true; - } - - /** Reads the content of a title object, executes the skin and captures the result */ - function getArticleHTML( $title ) { - global $wgOut, $wgTitle, $wgArticle, $wgUser; - - $linkCache =& LinkCache::singleton(); - $linkCache->clear(); - $wgTitle = $title; - if ( is_null( $wgTitle ) ) { - return false; - } - - $ns = $wgTitle->getNamespace(); - if ( $ns == NS_SPECIAL ) { - $wgOut = new OutputPage; - $wgOut->setParserOptions( new ParserOptions ); - SpecialPage::executePath( $wgTitle ); - } else { - /** @todo merge with Wiki.php code */ - if ( $ns == NS_IMAGE ) { - $wgArticle = new ImagePage( $wgTitle ); - } elseif ( $ns == NS_CATEGORY ) { - $wgArticle = new CategoryPage( $wgTitle ); - } else { - $wgArticle = new Article( $wgTitle ); - } - $rt = Title::newFromRedirect( $wgArticle->fetchContent() ); - if ( $rt != NULL ) { - return $this->getRedirect( $rt ); - } else { - $wgOut = new OutputPage; - $wgOut->setParserOptions( new ParserOptions ); - - $wgArticle->view(); - } - } - - - $sk =& $wgUser->getSkin(); - ob_start(); - $sk->outputPage( $wgOut ); - $text = ob_get_contents(); - ob_end_clean(); - - return $text; - } - - function getRedirect( $rt ) { - $url = $rt->escapeLocalURL(); - $text = $rt->getPrefixedText(); - return <<<ENDTEXT -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Refresh" content="0;url=$url" /> -</head> -<body> - <p>Redirecting to <a href="$url">$text</a></p> -</body> -</html> -ENDTEXT; - } - - /** Returns image paths used in an XHTML document */ - function findImages( $text ) { - global $wgOutputEncoding, $wgDumpImages; - $parser = xml_parser_create( $wgOutputEncoding ); - xml_set_element_handler( $parser, 'wfDumpStartTagHandler', 'wfDumpEndTagHandler' ); - - $wgDumpImages = array(); - xml_parse( $parser, $text ); - xml_parser_free( $parser ); - - return $wgDumpImages; - } - - /** - * Copy a file specified by a URL to a given directory - * - * @param string $srcPath The source URL - * @param string $srcPathBase The base directory of the source URL - * @param string $srcDirBase The base filesystem directory of the source URL - * @param string $destDirBase The base filesystem directory of the destination URL - */ - function relativeCopy( $srcPath, $srcPathBase, $srcDirBase, $destDirBase ) { - $rel = substr( $srcPath, strlen( $srcPathBase ) + 1 ); // +1 for slash - $sourceLoc = "$srcDirBase/$rel"; - $destLoc = "$destDirBase/$rel"; - #print "Copying $sourceLoc to $destLoc\n"; - if ( !file_exists( $destLoc ) ) { - wfMkdirParents( dirname( $destLoc ), 0755 ); - if ( function_exists( 'symlink' ) && !$this->forceCopy ) { - if ( !symlink( $sourceLoc, $destLoc ) ) { - print "Warning: unable to create symlink at $destLoc\n"; - } - } else { - if ( !copy( $sourceLoc, $destLoc ) ) { - print "Warning: unable to copy $sourceLoc to $destLoc\n"; - } - } - } - } - - /** - * Copy an image, and if it is a thumbnail, copy its parent image too - */ - function copyImage( $srcPath, $srcPathBase, $srcDirBase, $destDirBase ) { - global $wgUploadPath, $wgUploadDirectory, $wgSharedUploadPath; - $this->relativeCopy( $srcPath, $srcPathBase, $srcDirBase, $destDirBase ); - if ( substr( $srcPath, strlen( $srcPathBase ) + 1, 6 ) == 'thumb/' ) { - # The image was a thumbnail - # Copy the source image as well - $rel = substr( $srcPath, strlen( $srcPathBase ) + 1 ); - $parts = explode( '/', $rel ); - $rel = "{$parts[1]}/{$parts[2]}/{$parts[3]}"; - $newSrc = "$srcPathBase/$rel"; - $this->relativeCopy( $newSrc, $srcPathBase, $srcDirBase, $destDirBase ); - } - } - - /** - * Copy images (or create symlinks) from commons to a static directory. - * This is necessary even if you intend to distribute all of commons, because - * the directory contents is used to work out which image description pages - * are needed. - * - * Also copies math images, and full-sized images if the makeSnapshot option - * is specified. - * - */ - function copyImages( $images ) { - global $wgUploadPath, $wgUploadDirectory, $wgSharedUploadPath, $wgSharedUploadDirectory, - $wgMathPath, $wgMathDirectory; - # Find shared uploads and copy them into the static directory - $sharedPathLength = strlen( $wgSharedUploadPath ); - $mathPathLength = strlen( $wgMathPath ); - $uploadPathLength = strlen( $wgUploadPath ); - foreach ( $images as $escapedImage => $dummy ) { - $image = urldecode( $escapedImage ); - - if ( substr( $image, 0, $sharedPathLength ) == $wgSharedUploadPath ) { - $this->copyImage( $image, $wgSharedUploadPath, $wgSharedUploadDirectory, $this->sharedStaticDirectory ); - } elseif ( substr( $image, 0, $mathPathLength ) == $wgMathPath ) { - $this->relativeCopy( $image, $wgMathPath, $wgMathDirectory, "{$this->dest}/math" ); - } elseif ( $this->makeSnapshot && substr( $image, 0, $uploadPathLength ) == $wgUploadPath ) { - $this->copyImage( $image, $wgUploadPath, $wgUploadDirectory, $this->destUploadDirectory ); - } - } - } - - function onGetFullURL( &$title, &$url, $query ) { - global $wgContLang, $wgArticlePath; - - $iw = $title->getInterwiki(); - if ( $title->isExternal() && $wgContLang->getLanguageName( $iw ) ) { - if ( $title->getDBkey() == '' ) { - $url = str_replace( '$1', "../$iw/index.html", $wgArticlePath ); - } else { - $url = str_replace( '$1', "../$iw/" . wfUrlencode( $this->getHashedFilename( $title ) ), - $wgArticlePath ); - } - $url .= $this->compress ? ".gz" : ""; - return false; - } else { - return true; - } - } - - function onGetLocalURL( &$title, &$url, $query ) { - global $wgArticlePath; - - if ( $title->isExternal() ) { - # Default is fine for interwiki - return true; - } - - $url = false; - if ( $query != '' ) { - $params = array(); - parse_str( $query, $params ); - if ( isset($params['action']) && $params['action'] == 'raw' ) { - if ( $params['gen'] == 'css' || $params['gen'] == 'js' ) { - $file = 'gen.' . $params['gen']; - } else { - $file = $this->getFriendlyName( $title->getPrefixedDBkey() ); - // Clean up Monobook.css etc. - $matches = array(); - if ( preg_match( '/^(.*)\.(css|js)_[0-9a-f]{4}$/', $file, $matches ) ) { - $file = $matches[1] . '.' . $matches[2]; - } - } - $this->rawPages[$file] = array( $file, $title, $params ); - $url = str_replace( '$1', "raw/" . wfUrlencode( $file ), $wgArticlePath ); - } - } - if ( $url === false ) { - $url = str_replace( '$1', wfUrlencode( $this->getHashedFilename( $title ) ), $wgArticlePath ); - } - $url .= $this->compress ? ".gz" : ""; - return false; - } - - function getHashedFilename( &$title ) { - if ( '' != $title->mInterwiki ) { - $dbkey = $title->getDBkey(); - } else { - $dbkey = $title->getPrefixedDBkey(); - } - - $mainPage = Title::newMainPage(); - if ( $mainPage->getPrefixedDBkey() == $dbkey ) { - return 'index.html'; - } - - return $this->getHashedDirectory( $title ) . '/' . - $this->getFriendlyName( $dbkey ) . '.html'; - } - - function getFriendlyName( $name ) { - global $wgLang; - # Replace illegal characters for Windows paths with underscores - $friendlyName = strtr( $name, '/\\*?"<>|~', '_________' ); - - # Work out lower case form. We assume we're on a system with case-insensitive - # filenames, so unless the case is of a special form, we have to disambiguate - if ( function_exists( 'mb_strtolower' ) ) { - $lowerCase = $wgLang->ucfirst( mb_strtolower( $name ) ); - } else { - $lowerCase = ucfirst( strtolower( $name ) ); - } - - # Make it mostly unique - if ( $lowerCase != $friendlyName ) { - $friendlyName .= '_' . substr(md5( $name ), 0, 4); - } - # Handle colon specially by replacing it with tilde - # Thus we reduce the number of paths with hashes appended - $friendlyName = str_replace( ':', '~', $friendlyName ); - - return $friendlyName; - } - - /** - * Get a relative directory for putting a title into - */ - function getHashedDirectory( &$title ) { - if ( '' != $title->getInterwiki() ) { - $pdbk = $title->getDBkey(); - } else { - $pdbk = $title->getPrefixedDBkey(); - } - - # Find the first colon if there is one, use characters after it - $p = strpos( $pdbk, ':' ); - if ( $p !== false ) { - $dbk = substr( $pdbk, $p + 1 ); - $dbk = substr( $dbk, strspn( $dbk, '_' ) ); - } else { - $dbk = $pdbk; - } - - # Split into characters - $m = array(); - preg_match_all( '/./us', $dbk, $m ); - - $chars = $m[0]; - $length = count( $chars ); - $dir = ''; - - for ( $i = 0; $i < $this->depth; $i++ ) { - if ( $i ) { - $dir .= '/'; - } - if ( $i >= $length ) { - $dir .= '_'; - } else { - $c = $chars[$i]; - if ( ord( $c ) >= 128 || preg_match( '/[a-zA-Z0-9!#$%&()+,[\]^_`{}-]/', $c ) ) { - if ( function_exists( 'mb_strtolower' ) ) { - $dir .= mb_strtolower( $c ); - } else { - $dir .= strtolower( $c ); - } - } else { - $dir .= sprintf( "%02X", ord( $c ) ); - } - } - } - return $dir; - } - - /** - * Calculate the start end end of a job based on the current slice - * @param integer $start - * @param integer $end - * @return array of integers - */ - function sliceRange( $start, $end ) { - $count = $end - $start + 1; - $each = $count / $this->sliceDenominator; - $sliceStart = $start + intval( $each * ( $this->sliceNumerator - 1 ) ); - if ( $this->sliceNumerator == $this->sliceDenominator ) { - $sliceEnd = $end; - } else { - $sliceEnd = $start + intval( $each * $this->sliceNumerator ) - 1; - } - return array( $sliceStart, $sliceEnd ); - } - - /** - * Adjust a start point so that it belongs to the current slice, where slices are defined by integer modulo - * @param integer $start - * @param integer $base The true start of the range; the minimum start - */ - function modSliceStart( $start, $base = 1 ) { - return $start - ( $start % $this->sliceDenominator ) + $this->sliceNumerator - 1 + $base; - } - - /** - * Determine whether a string belongs to the current slice, based on hash - */ - function sliceFilter( $s ) { - return crc32( $s ) % $this->sliceDenominator == $this->sliceNumerator - 1; - } - - /** - * No site notice - */ - function onSiteNoticeBefore( &$text ) { - $text = ''; - return false; - } - function onSiteNoticeAfter( &$text ) { - $text = ''; - return false; - } - - function getMaxPageID() { - if ( $this->maxPageID === false ) { - $dbr = wfGetDB( DB_SLAVE ); - $this->maxPageID = $dbr->selectField( 'page', 'max(page_id)', false, __METHOD__ ); - } - return $this->maxPageID; - } - - function profile() { - global $wgProfiler; - - if ( !$this->udpProfile ) { - return; - } - if ( !$this->udpProfileInit ) { - $this->udpProfileInit = true; - } elseif ( $this->udpProfileCounter == 1 % $this->udpProfile ) { - $wgProfiler->getFunctionReport(); - $wgProfiler = new DumpHTML_ProfilerStub; - } - if ( $this->udpProfileCounter == 0 ) { - $wgProfiler = new ProfilerSimpleUDP; - $wgProfiler->setProfileID( 'dumpHTML' ); - } - $this->udpProfileCounter = ( $this->udpProfileCounter + 1 ) % $this->udpProfile; - } -} - -class DumpHTML_ProfilerStub { - function profileIn() {} - function profileOut() {} - function getOutput() {} - function close() {} - function getFunctionReport() {} -} - -/** XML parser callback */ -function wfDumpStartTagHandler( $parser, $name, $attribs ) { - global $wgDumpImages; - - if ( $name == 'IMG' && isset( $attribs['SRC'] ) ) { - $wgDumpImages[$attribs['SRC']] = true; - } -} - -/** XML parser callback */ -function wfDumpEndTagHandler( $parser, $name ) {} - -# vim: syn=php -?> diff --git a/maintenance/dumpMessages.php b/maintenance/dumpMessages.php deleted file mode 100644 index 84ecc4c6..00000000 --- a/maintenance/dumpMessages.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/** - * @todo document - * @package MediaWiki - * @subpackage Maintenance - */ - -/** */ -require_once( "commandLine.inc" ); -$wgMessageCache->disableTransform(); -$messages = array(); -foreach ( $wgAllMessagesEn as $key => $englishValue ) -{ - $messages[$key] = wfMsg( $key ); -} -print "MediaWiki $wgVersion language file\n"; -print serialize( $messages ); - -?> diff --git a/maintenance/dumpReplayLog.php b/maintenance/dumpReplayLog.php deleted file mode 100644 index 07749f41..00000000 --- a/maintenance/dumpReplayLog.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/** - * @addtogroup Maintenance - */ -error_reporting(E_ALL); - -/** */ -require_once( "commandLine.inc" ); -require_once( 'includes/SpecialExport.php' ); - -/** */ -function dumpReplayLog( $start ) { - $dbw = wfGetDB( DB_MASTER ); - $recentchanges = $dbw->tableName( 'recentchanges' ); - $result =& $dbw->safeQuery( "SELECT * FROM $recentchanges WHERE rc_timestamp >= " - . $dbw->timestamp( $start ) . ' ORDER BY rc_timestamp'); - - global $wgInputEncoding; - echo '<' . '?xml version="1.0" encoding="' . $wgInputEncoding . '" ?' . ">\n"; - echo "<wikilog version='experimental'>\n"; - echo "<!-- Do not use this script for any purpose. It's scary. -->\n"; - while( $row = $dbw->fetchObject( $result ) ) { - echo dumpReplayEntry( $row ); - } - echo "</wikilog>\n"; - $dbw->freeResult( $result ); -} - -/** */ -function dumpReplayEntry( $row ) { - $title = Title::MakeTitle( $row->rc_namespace, $row->rc_title ); - switch( $row->rc_type ) { - case RC_EDIT: - case RC_NEW: - # Edit - $dbr = wfGetDB( DB_MASTER ); - - $out = " <edit>\n"; - $out .= " <title>" . xmlsafe( $title->getPrefixedText() ) . "</title>\n"; - - # Get previous edit timestamp - if( $row->rc_last_oldid ) { - $s = $dbr->selectRow( 'old', - array( 'old_timestamp' ), - array( 'old_id' => $row->rc_last_oldid ) ); - $out .= " <lastedit>" . wfTimestamp2ISO8601( $s->old_timestamp ) . "</lastedit>\n"; - } else { - $out .= " <newpage/>\n"; - } - - if( $row->rc_this_oldid ) { - $s = $dbr->selectRow( 'old', array( 'old_id as id','old_timestamp as timestamp', - 'old_user as user', 'old_user_text as user_text', 'old_comment as comment', - 'old_text as text', 'old_flags as flags' ), - array( 'old_id' => $row->rc_this_oldid ) ); - $out .= revision2xml( $s, true, false ); - } else { - $s = $dbr->selectRow( 'cur', array( 'cur_id as id','cur_timestamp as timestamp','cur_user as user', - 'cur_user_text as user_text', 'cur_restrictions as restrictions','cur_comment as comment', - 'cur_text as text' ), - array( 'cur_id' => $row->rc_cur_id ) ); - $out .= revision2xml( $s, true, true ); - } - $out .= " </edit>\n"; - break; - case RC_LOG: - $dbr = wfGetDB( DB_MASTER ); - $s = $dbr->selectRow( 'logging', - array( 'log_type', 'log_action', 'log_timestamp', 'log_user', - 'log_namespace', 'log_title', 'log_comment' ), - array( 'log_timestamp' => $row->rc_timestamp, - 'log_user' => $row->rc_user ) ); - $ts = wfTimestamp2ISO8601( $row->rc_timestamp ); - $target = Title::MakeTitle( $s->log_namespace, $s->log_title ); - $out = " <log>\n"; - $out .= " <type>" . xmlsafe( $s->log_type ) . "</type>\n"; - $out .= " <action>" . xmlsafe( $s->log_action ) . "</action>\n"; - $out .= " <timestamp>" . $ts . "</timestamp>\n"; - $out .= " <contributor><username>" . xmlsafe( $row->rc_user_text ) . "</username></contributor>\n"; - $out .= " <target>" . xmlsafe( $target->getPrefixedText() ) . "</target>\n"; - $out .= " <comment>" . xmlsafe( $s->log_comment ) . "</comment>\n"; - $out .= " </log>\n"; - break; - case RC_MOVE: - case RC_MOVE_OVER_REDIRECT: - $target = Title::MakeTitle( $row->rc_moved_to_ns, $row->rc_moved_to_title ); - $out = " <move>\n"; - $out .= " <title>" . xmlsafe( $title->getPrefixedText() ) . "</title>\n"; - $out .= " <target>" . xmlsafe( $target->getPrefixedText() ) . "</target>\n"; - if( $row->rc_type == RC_MOVE_OVER_REDIRECT ) { - $out .= " <override/>\n"; - } - $ts = wfTimestamp2ISO8601( $row->rc_timestamp ); - $out .= " <id>$row->rc_cur_id</id>\n"; - $out .= " <timestamp>$ts</timestamp>\n"; - if($row->rc_user_text) { - $u = "<username>" . xmlsafe( $row->rc_user_text ) . "</username>"; - $u .= "<id>$row->rc_user</id>"; - } else { - $u = "<ip>" . xmlsafe( $row->rc_user_text ) . "</ip>"; - } - $out .= " <contributor>$u</contributor>\n"; - $out .= " </move>\n"; - } - return $out; -} - - -if( isset( $options['start'] ) ) { - $start = wfTimestamp( TS_MW, $options['start'] ); - dumpReplayLog( $start ); -} else { - echo "This is an experimental script to encapsulate data from recent edits.\n"; - echo "Usage: php dumpReplayLog.php --start=20050118032544\n"; -} - -?>
\ No newline at end of file diff --git a/maintenance/duplicatetrans.php b/maintenance/duplicatetrans.php deleted file mode 100644 index 89d9cff1..00000000 --- a/maintenance/duplicatetrans.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -/** - * Prints out messages that are the same as the message with the corrisponding - * key in the Language.php file - * - * @package MediaWiki - * @subpackage Maintenance - */ - -require_once('commandLine.inc'); - -if ( 'en' == $wgLanguageCode ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} - -$count = $total = 0; -$msgarray = 'wgAllMessages' . ucfirst( $wgLanguageCode ); - -foreach ( $$msgarray as $code => $msg ) { - ++$total; - if ( @$wgAllMessagesEn[$code] == $msg ) { - echo "* $code\n"; - ++$count; - } -} - -echo "{$count} messages of {$total} are duplicates\n"; -?> diff --git a/maintenance/entities2literals.pl b/maintenance/entities2literals.pl deleted file mode 100644 index dd47f6bb..00000000 --- a/maintenance/entities2literals.pl +++ /dev/null @@ -1,276 +0,0 @@ -#!/usr/bin/env perl -# Takes STDIN and converts Converts hexadecimal, decimal and named HTML -# entities to their respective literals. -# -# Usage: perl entities2literals.pl < file_to_convert [> outfile] -# Reference: http://www.w3.org/TR/REC-html40/sgml/entities.html -# Copyright 2005 Ævar Arnfjörð Bjarmason <avarab@gmail.com> No rights reserved - -use encoding 'utf8'; -use strict; - -my $file = join /\n/, <>; - -$file =~ s/&#(\d+);/chr $1/eg; -$file =~ s/&#x([0-9a-fA-F]+);/chr hex $1/eg; - -while (<DATA>) { - chomp; - my ($number, $entity) = split / +/; - $file =~ s/&$entity;/chr $number/eg; -} -print $file; - -__DATA__ -34 quot -38 amp -60 lt -62 gt -160 nbsp -161 iexcl -162 cent -163 pound -164 curren -165 yen -166 brvbar -167 sect -168 uml -169 copy -170 ordf -171 laquo -172 not -173 shy -174 reg -175 macr -176 deg -177 plusmn -178 sup2 -179 sup3 -180 acute -181 micro -182 para -183 middot -184 cedil -185 sup1 -186 ordm -187 raquo -188 frac14 -189 frac12 -190 frac34 -191 iquest -192 Agrave -193 Aacute -194 Acirc -195 Atilde -196 Auml -197 Aring -198 AElig -199 Ccedil -200 Egrave -201 Eacute -202 Ecirc -203 Euml -204 Igrave -205 Iacute -206 Icirc -207 Iuml -208 ETH -209 Ntilde -210 Ograve -211 Oacute -212 Ocirc -213 Otilde -214 Ouml -215 times -216 Oslash -217 Ugrave -218 Uacute -219 Ucirc -220 Uuml -221 Yacute -222 THORN -223 szlig -224 agrave -225 aacute -226 acirc -227 atilde -228 auml -229 aring -230 aelig -231 ccedil -232 egrave -233 eacute -234 ecirc -235 euml -236 igrave -237 iacute -238 icirc -239 iuml -240 eth -241 ntilde -242 ograve -243 oacute -244 ocirc -245 otilde -246 ouml -247 divide -248 oslash -249 ugrave -250 uacute -251 ucirc -252 uuml -253 yacute -254 thorn -255 yuml -338 OElig -339 oelig -352 Scaron -353 scaron -376 Yuml -402 fnof -710 circ -732 tilde -913 Alpha -914 Beta -915 Gamma -916 Delta -917 Epsilon -918 Zeta -919 Eta -920 Theta -921 Iota -922 Kappa -923 Lambda -924 Mu -925 Nu -926 Xi -927 Omicron -928 Pi -929 Rho -931 Sigma -932 Tau -933 Upsilon -934 Phi -935 Chi -936 Psi -937 Omega -945 alpha -946 beta -947 gamma -948 delta -949 epsilon -950 zeta -951 eta -952 theta -953 iota -954 kappa -955 lambda -956 mu -957 nu -958 xi -959 omicron -960 pi -961 rho -962 sigmaf -963 sigma -964 tau -965 upsilon -966 phi -967 chi -968 psi -969 omega -977 thetasym -978 upsih -982 piv -8194 ensp -8195 emsp -8201 thinsp -8204 zwnj -8205 zwj -8206 lrm -8207 rlm -8211 ndash -8212 mdash -8216 lsquo -8217 rsquo -8218 sbquo -8220 ldquo -8221 rdquo -8222 bdquo -8224 dagger -8225 Dagger -8226 bull -8230 hellip -8240 permil -8242 prime -8243 Prime -8249 lsaquo -8250 rsaquo -8254 oline -8260 frasl -8364 euro -8465 image -8472 weierp -8476 real -8482 trade -8501 alefsym -8592 larr -8593 uarr -8594 rarr -8595 darr -8596 harr -8629 crarr -8656 lArr -8657 uArr -8658 rArr -8659 dArr -8660 hArr -8704 forall -8706 part -8707 exist -8709 empty -8711 nabla -8712 isin -8713 notin -8715 ni -8719 prod -8721 sum -8722 minus -8727 lowast -8730 radic -8733 prop -8734 infin -8736 ang -8743 and -8744 or -8745 cap -8746 cup -8747 int -8756 there4 -8764 sim -8773 cong -8776 asymp -8800 ne -8801 equiv -8804 le -8805 ge -8834 sub -8835 sup -8836 nsub -8838 sube -8839 supe -8853 oplus -8855 otimes -8869 perp -8901 sdot -8968 lceil -8969 rceil -8970 lfloor -8971 rfloor -9001 lang -9002 rang -9674 loz -9824 spades -9827 clubs -9829 hearts -9830 diams diff --git a/maintenance/importPhase2.php b/maintenance/importPhase2.php deleted file mode 100644 index a923b3da..00000000 --- a/maintenance/importPhase2.php +++ /dev/null @@ -1,368 +0,0 @@ -<?php -# MediaWiki 'phase 2' to current format import script -# (import format current as of 1.2.0, March 2004) -# -# Copyright (C) 2004 Brion Vibber <brion@pobox.com> -# Portions by Lee Daniel Crocker, 2002 -# http://www.mediawiki.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# http://www.gnu.org/copyleft/gpl.html - -/** - * @todo document - * @deprecated - * @addtogroup Maintenance - */ - -/** */ -die( "This import script is not currently maintained. -If you need it you'll have to modify it as necessary.\n"); - -if ( ! is_readable( "../LocalSettings.php" ) ) { - print "A copy of your installation's LocalSettings.php\n" . - "must exist in the source directory.\n"; - exit(); -} - -$wgCommandLineMode = true; -ini_set("implicit_flush", 1); - -$DP = "../includes"; -require_once( "../LocalSettings.php" ); -require_once( "../AdminSettings.php" ); - -$wgDBuser = $wgDBadminuser; -$wgDBpassword = $wgDBadminpassword; - -$sep = ( DIRECTORY_SEPARATOR == "\\" ) ? ";" : ":"; -ini_set( "include_path", "$IP$sep$include_path" ); - -require_once( "Setup.php" ); - -require_once( "../install-utils.inc" ); -require_once( "InitialiseMessages.inc" ); -require_once( "rebuildlinks.inc" ); -require_once( "rebuildrecentchanges.inc" ); -require_once( "rebuildtextindex.inc" ); - -/** - * @todo document - * @addtogroup Maintenance - */ -class Phase2Importer { - var $olddb, $titleCache; - - function Phase2Importer( $database ) { - $this->olddb = $database; - $this->titleCache = new TitleCache; - } - - function importAll() { - $this->importCurData(); - $this->fixCurTitles(); - - $this->importOldData(); - $this->fixOldTitles(); - - $this->importUserData(); - $this->fixUserOptions(); - - $this->importWatchlists(); - - $this->importLinkData(); - - /* - # For some reason this is broken. RecentChanges will just start anew... - rebuildRecentChangesTablePass1(); - rebuildRecentChangesTablePass2(); - */ - - print "Rebuilding search index:\n"; - dropTextIndex(); - rebuildTextIndex(); - createTextIndex(); - - initialiseMessages(); - } - - # Simple import functions; for the most part these are pretty straightforward. - # MySQL copies everything over to the new database and tweaks a few things. - function importCurData() { - print "Clearing pages from default install, if any...\n"; - wfQuery( "DELETE FROM cur", DB_MASTER ); - - print "Importing current revision data...\n"; - wfQuery( "INSERT INTO cur (cur_id,cur_namespace,cur_title,cur_text,cur_comment, - cur_user,cur_user_text,cur_timestamp,cur_restrictions,cur_counter, - cur_is_redirect,cur_minor_edit,cur_is_new,cur_random,cur_touched) - SELECT cur_id,0,cur_title,cur_text,cur_comment, - cur_user,cur_user_text,cur_timestamp,REPLACE(cur_restrictions,'is_',''),cur_counter, - cur_text like '#redirect%',cur_minor_edit,0,RAND(),NOW()+0, - FROM {$this->olddb}.cur", DB_MASTER ); - $n = mysql_affected_rows(); - print "$n rows imported.\n"; - } - - function importOldData() { - print "Clearing old revision data from default install, if any...\n"; - wfQuery( "DELETE FROM old", DB_MASTER ); - - print "Importing old revision data...\n"; - wfQuery( "INSERT INTO old (old_id,old_namespace,old_title,old_text,old_comment, - old_user,old_user_text,old_timestamp,old_minor_edit,old_flags) - SELECT old_id,0,old_title,old_text,old_comment, - old_user,old_user_text,old_timestamp,old_minor_edit,'' - FROM {$this->olddb}.old", DB_MASTER ); - $n = mysql_affected_rows(); - print "$n rows imported.\n"; - } - - function importUserData() { - print "Clearing users from default install, if any...\n"; - wfQuery( "DELETE FROM user", DB_MASTER ); - - print "Importing user data...\n"; - wfQuery( "INSERT INTO user (user_id,user_name,user_rights, - user_password,user_newpassword,user_email,user_options,user_touched) - SELECT user_id,user_name,REPLACE(user_rights,'is_',''), - MD5(CONCAT(user_id,'-',MD5(user_password))),'',user_email,user_options,NOW()+0 - FROM {$this->olddb}.user", DB_MASTER ); - $n = mysql_affected_rows(); - print "$n rows imported.\n"; - } - - # A little less clean... - function importWatchlists() { - print "Clearing watchlists from default install, if any...\n"; - wfQuery( "DELETE FROM watchlist", DB_MASTER ); - - print "Importing watchlists..."; - $res = wfQuery( "SELECT user_id,user_watch FROM {$this->olddb}.user WHERE user_watch != ''", DB_MASTER ); - $total = wfNumRows( $res ); - $n = 0; - print " ($total total)\n"; - - while( $row = wfFetchObject( $res ) ) { - $id = intval( $row->user_id ); - $list = explode( "\n", $row->user_watch ); - foreach( $list as $page ) { - $title = $this->titleCache->fetch( $page ); - if( is_null( $title ) ) { - print "Caught bad title '{$row->title}'\n"; - } else { - $ns = $title->getNamespace(); - $t = wfStrencode( $title->getDBkey() ); - wfQuery( "INSERT INTO watchlist(wl_user,wl_namespace,wl_title) VALUES ($id,$ns,'$t')", DB_MASTER ); - } - } - if( ++$n % 50 == 0 ) { - print "$n\n"; - } - } - wfFreeResult( $res ); - } - - function importLinkData() { - # MUST BE CALLED BEFORE! fixCurTitles() - print "Clearing links from default install, if any...\n"; - wfQuery( "DELETE FROM links", DB_MASTER ); - wfQuery( "DELETE FROM brokenlinks", DB_MASTER ); - - print "Importing live links..."; - wfQuery( "INSERT INTO links (l_from, l_to) - SELECT DISTINCT linked_from,cur_id - FROM {$this->olddb}.linked,{$this->olddb}.cur - WHERE linked_to=cur_title", DB_MASTER ); - $n = mysql_affected_rows(); - print "$n rows imported.\n"; - - print "Importing broken links..."; - wfQuery( "INSERT INTO brokenlinks (bl_from, bl_to) - SELECT DISTINCT cur_id,unlinked_to - FROM {$this->olddb}.unlinked,{$this->olddb}.cur - WHERE unlinked_from=cur_title", DB_MASTER ); - $n = mysql_affected_rows(); - print "$n rows imported.\n"; - } - - # Fixup functions: munge data that's already been brought into tables - function fixCurTitles() { - $this->fixTitles( "cur" ); - } - - function fixOldTitles() { - $this->fixTitles( "old" ); - } - - function fixTitles( $table ) { - print "Fixing titles in $table..."; - $res = wfQuery( "SELECT DISTINCT {$table}_title AS title FROM $table", DB_MASTER ); - $total = wfNumRows( $res ); - $n = 0; - print " ($total total)\n"; - - while( $row = wfFetchObject( $res ) ) { - $xt = wfStrencode( $row->title ); - $title = $this->titleCache->fetch( $row->title ); - if( is_null( $title ) ) { - print "Caught bad title '{$row->title}'\n"; - } else { - $ns = $title->getNamespace(); - $t = wfStrencode( $title->getDBkey() ); - wfQuery( "UPDATE $table SET {$table}_namespace=$ns,{$table}_title='$t' - WHERE {$table}_namespace=0 AND {$table}_title='$xt'", DB_MASTER ); - } - if( ++$n % 50 == 0 ) { - print "$n\n"; - } - } - wfFreeResult( $res ); - } - - function rewriteUserOptions( $in ) - { - $s = urldecode( $in ); - $a = explode( "\n", $s ); - - foreach ( $a as $l ) { - $m = array(); - if ( preg_match( "/^([A-Za-z0-9_]+)=(.*)/", $l, $m ) ) { - $ops[$m[1]] = $m[2]; - } - } - $nops = array(); - - $q = strtolower( $ops["quickBar"] ); - if ( $q == "none" ) { $q = 0; } - else { $q = 1; } # Default to left - $nops["quickbar"] = $q; - - if ( $ops["markupNewTopics"] == "inverse" ) { - $nops["highlightbroken"] = 1; - } - $sk = substr( strtolower( $ops["skin"] ), 0, 4 ); - if ( "star" == $sk ) { $sk = 0; } - else if ( "nost" == $sk ) { $sk = 1; } - else if ( "colo" == $sk ) { $sk = 2; } - else { $sk = 0; } - $nops["skin"] = $sk; - - $u = strtolower( $ops["underlineLinks"] ); - if ( "yes" == $u || "on" == $u ) { $nops["underline"] = 1; } - else { $nops["underline"] = 0; } - - $t = ( (int) ($ops["hourDiff"]) ); - if ( $t < -23 || $t > 23 ) { $t = 0; } - if ( 0 != $t ) { $nops["timecorrection"] = $t; } - - $j = strtolower( $ops["justify"] ); - if ( "yes" == $j || "on" == $j ) { $nops["justify"] = 1; } - $n = strtolower( $ops["numberHeadings"] ); - if ( "yes" == $n || "on" == $n ) { $nops["numberheadings"] = 1; } - $h = strtolower( $ops["hideMinor"] ); - if ( "yes" == $h || "on" == $h ) { $nops["hideminor"] = 1; } - $r = strtolower( $ops["rememberPassword"] ); - if ( "yes" == $r || "on" == $r ) { $nops["rememberpassword"] = 1; } - $s = strtolower( $ops["showHover"] ); - if ( "yes" == $s || "on" == $s ) { $nops["hover"] = 1; } - - $c = $ops["cols"]; - if ( $c < 20 || $c > 200 ) { $nops["cols"] = 80; } - else { $nops["cols"] = $c; } - $r = $ops["rows"]; - if ( $r < 5 || $r > 100 ) { $nops["rows"] = 20; } - else { $nops["rows"] = $r; } - $r = $ops["resultsPerPage"]; - if ( $r < 3 || $r > 500 ) { $nops["searchlimit"] = 20; } - else { $nops["searchlimit"] = $r; } - $r = $ops["viewRecentChanges"]; - if ( $r < 10 || $r > 1000 ) { $nops["rclimit"] = 50; } - else { $nops["rclimit"] = $r; } - $nops["rcdays"] = 3; - - $a = array(); - foreach ( $nops as $oname => $oval ) { - array_push( $a, "$oname=$oval" ); - } - $s = implode( "\n", $a ); - return $s; - } - - function fixUserOptions() { - print "Fixing user options..."; - $res = wfQuery( "SELECT user_id,user_options FROM user", DB_MASTER ); - $total = wfNumRows( $res ); - $n = 0; - print " ($total total)\n"; - - while( $row = wfFetchObject( $res ) ) { - $id = intval( $row->user_id ); - $option = wfStrencode( $this->rewriteUserOptions( $row->user_options ) ); - wfQuery( "UPDATE user SET user_options='$option' WHERE user_id=$id LIMIT 1", DB_MASTER ); - if( ++$n % 50 == 0 ) { - print "$n\n"; - } - } - wfFreeResult( $res ); - } - -} - -/** - * @todo document - * @addtogroup Maintenance - */ -class TitleCache { - var $hash = array(); - - function &fetch( $dbkey ) { - if( !isset( $this->hash[$dbkey] ) ) { - $this->hash[$dbkey] = Title::newFromDBkey( $dbkey ); - } - return $this->hash[$dbkey]; - } - -} - -# -print "You should have already run the installer to create a fresh, blank database.\n"; -print "Data will be inserted into '$wgDBname'. THIS SHOULD BE EMPTY AND ANY DATA IN IN WILL BE ERASED!\n"; -print "\nIf that's not what you want, ABORT NOW!\n\n"; - -print "Please enter the name of the old 'phase 2'-format database that will be used as a source:\n"; -print "Old database name [enciclopedia]: "; -$olddb = readconsole(); -if( empty( $olddb ) ) $olddb = "enciclopedia"; - -if( $olddb == $wgDBname ) { - die( "Can't upgrade in-place! You must create a new database and copy data into it.\n" ); -} - -print "\nSource database: '$olddb'\n"; -print " Dest database: '$wgDBname'\n"; -print "Is this correct? Anything in '$wgDBname' WILL BE DESTROYED. [y/N] "; -$response = readconsole(); -if( strtolower( $response{0} ) != 'y' ) { - die( "\nAborted by user.\n" ); -} - -print "Starting import....\n"; - -$wgTitle = Title::newFromText( "Conversion script" ); -$importer = new Phase2Importer( $olddb ); -$importer->importAll(); - -?> diff --git a/maintenance/importTextFile.inc b/maintenance/importTextFile.inc deleted file mode 100644 index 50b936c1..00000000 --- a/maintenance/importTextFile.inc +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -/** - * Support functions for the importTextFile script - * - * @package MediaWiki - * @subpackage Maintenance - * @author Rob Church <robchur@gmail.com> - */ - -require_once( "$IP/includes/RecentChange.php" ); - -/** - * Insert a new article - * - * @param $title Title of the article - * @param $text Text of the article - * @param $user User associated with the edit - * @param $comment Edit summary - * @param $rc Whether or not to add a recent changes event - * @return bool - */ -function insertNewArticle( &$title, $text, &$user, $comment, $rc ) { - if( !$title->exists() ) { - # Create the article - $dbw =& wfGetDB( DB_MASTER ); - $dbw->immediateBegin(); - $article = new Article( $title ); - $articleId = $article->insertOn( $dbw ); - # Prepare and save associated revision - $revision = new Revision( array( 'page' => $articleId, 'text' => $text, 'user' => $user->mId, 'user_text' => $user->getName(), 'comment' => $comment ) ); - $revisionId = $revision->insertOn( $dbw ); - # Make it the current revision - $article->updateRevisionOn( $dbw, $revision ); - $dbw->immediateCommit(); - # Update recent changes if appropriate - if( $rc ) - updateRecentChanges( $dbw, $title, $user, $comment, strlen( $text ), $articleId ); - # Touch links etc. - Article::onArticleCreate( $title ); - $article->editUpdates( $text, $comment, false, $dbw->timestamp(), $revisionId ); - return true; - } else { - # Title exists; touch nothing - return false; - } -} - -/** - * Turn a filename into a title - * - * @param $filename Filename to be transformed - * @return Title - */ -function titleFromFilename( $filename ) { - $parts = explode( '/', $filename ); - $parts = explode( '.', $parts[ count( $parts ) - 1 ] ); - return Title::newFromText( $parts[0] ); -} - -/** - * Update recent changes with the page creation event - * - * @param $dbw Database in use - * @param $title Title of the new page - * @param $user User responsible for the creation - * @param $comment Edit summary associated with the edit - * @param $size Size of the page - * @param $articleId Article identifier - */ -function updateRecentChanges( &$dbw, &$title, &$user, $comment, $size, $articleId ) { - RecentChange::notifyNew( $dbw->timestamp(), $title, false, $user, $comment, 'default', '', $size, $articleId ); -} - -?>
\ No newline at end of file diff --git a/maintenance/lang2po.php b/maintenance/lang2po.php deleted file mode 100644 index af6bceea..00000000 --- a/maintenance/lang2po.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php -/** - * Convert Language files to .po files ! - * - * Todo: - * - generate .po header - * - fix escaping of \ - */ - -/** This is a command line script */ -require_once('commandLine.inc'); -require_once('languages.inc'); - -define('ALL_LANGUAGES', true); -define('XGETTEXT_BIN', 'xgettext'); -define('MSGMERGE_BIN', 'msgmerge'); - -// used to generate the .pot -define('XGETTEXT_OPTIONS', '-n --keyword=wfMsg --keyword=wfMsgForContent --keyword=wfMsgHtml --keyword=wfMsgWikiHtml '); -define('MSGMERGE_OPTIONS', ' -v '); - -define('LOCALE_OUTPUT_DIR', $IP.'/locale'); - - -if( isset($options['help']) ) { usage(); wfDie(); } -// default output is WikiText -if( !isset($options['lang']) ) { $options['lang'] = ALL_LANGUAGES; } - -function usage() { -print <<<END -Usage: php lang2po.php [--help] [--lang=<langcode>] [--stdout] - --help: this message. - --lang: a lang code you want to generate a .po for (default: all languages). - -END; -} - - -/** - * Return a dummy header for later edition. - * @return string A dummy header - */ -function poHeader() { -return -'# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2005 MediaWiki -# This file is distributed under the same license as the MediaWiki package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: bugzilllaaaaa\n" -"POT-Creation-Date: 2005-08-16 20:13+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: VARIOUS <nobody>\n" -"Language-Team: LANGUAGE <nobody>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -'; -} - -/** - * generate and write a file in .po format. - * - * @param string $langcode Code of a language it will process. - * @param array &$messages Array containing the various messages. - * @return string Filename where stuff got saved or false. - */ -function generatePo($langcode, &$messages) { - $data = poHeader(); - - // Generate .po entries - foreach($messages as $identifier => $content) { - $data .= "msgid \"$identifier\"\n"; - - // Escape backslashes - $tmp = str_replace('\\', '\\\\', $content); - // Escape doublelquotes - $tmp = preg_replace( "/(?<!\\\\)\"/", '\"', $tmp); - // Rewrite multilines to gettext format - $tmp = str_replace("\n", "\"\n\"", $tmp); - - $data .= 'msgstr "'. $tmp . "\"\n\n"; - } - - // Write the content to a file in locale/XX/messages.po - $dir = LOCALE_OUTPUT_DIR.'/'.$langcode; - if( !is_dir($dir) ) { mkdir( $dir, 0770 ); } - $filename = $dir.'/fromlanguagefile.po'; - - $file = fopen( $filename , 'wb' ); - if( fwrite( $file, $data ) ) { - fclose( $file ); - return $filename; - } else { - fclose( $file ); - return false; - } -} - -function generatePot() { - global $IP; - $curdir = getcwd(); - chdir($IP); - exec( XGETTEXT_BIN - .' '.XGETTEXT_OPTIONS - .' -o '.LOCALE_OUTPUT_DIR.'/wfMsg.pot' - .' includes/*php' - ); - chdir($curdir); -} - -function applyPot($langcode) { - $langdir = LOCALE_OUTPUT_DIR.'/'.$langcode; - - $from = $langdir.'/fromlanguagefile.po'; - $pot = LOCALE_OUTPUT_DIR.'/wfMsg.pot'; - $dest = $langdir.'/messages.po'; - - // Merge template and generate file to get final .po - exec(MSGMERGE_BIN.MSGMERGE_OPTIONS." $from $pot -o $dest "); - // delete no more needed file -// unlink($from); -} - -// Generate a template .pot based on source tree -echo "Getting 'gettext' default messages from sources:"; -generatePot(); -echo "done.\n"; - - -$langTool = new languages(); - -// Do all languages -foreach ( $langTool->getList() as $langcode) { - echo "Loading messages for $langcode:\t"; - require_once( 'languages/Language' . $langcode . '.php' ); - $arr = 'wgAllMessages'.$langcode; - if(!@is_array($$arr)) { - echo "NONE FOUND\n"; - } else { - echo "ok\n"; - if( ! generatePo($langcode, $$arr) ) { - echo "ERROR: Failed to wrote file.\n"; - } else { - echo "Applying template:"; - applyPot($langcode); - } - } -} -?> diff --git a/maintenance/langmemusage.php b/maintenance/langmemusage.php deleted file mode 100644 index d45de0e4..00000000 --- a/maintenance/langmemusage.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * Dumb program that tries to get the memory usage - * for each language file. - */ - -/** This is a command line script */ -require_once('commandLine.inc'); -require_once('languages.inc'); - -$langtool = new languages(); - -if ( ! function_exists( 'memory_get_usage' ) ) - wfDie( "You must compile PHP with --enable-memory-limit\n" ); - -$memlast = $memstart = memory_get_usage(); - -print 'Base memory usage: '.$memstart."\n"; - -foreach($langtool->getList() as $langcode) { - require_once('languages/Language'.$langcode.'.php'); - $memstep = memory_get_usage(); - printf( "%12s: %d\n", $langcode, ($memstep- $memlast) ); - $memlast = $memstep; -} - -$memend = memory_get_usage(); - -echo ' Total Usage: '.($memend - $memstart)."\n"; -?> diff --git a/maintenance/language/checkExtensioni18n.php b/maintenance/language/checkExtensioni18n.php deleted file mode 100644 index 7a131a08..00000000 --- a/maintenance/language/checkExtensioni18n.php +++ /dev/null @@ -1,279 +0,0 @@ -<?php -/** - * Copyright (C) 2007 Ashar Voultoiz <hashar@altern.org> - * - * Based on dumpBackup: - * Copyright (C) 2005 Brion Vibber <brion@pobox.com> - * - * http://www.mediawiki.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * http://www.gnu.org/copyleft/gpl.html - * - * @addtogroup SpecialPage - */ - -# -# Lacking documentation. Examples: -# php checkExtensioni18n.php /opt/mw/extensions/CentralAuth/CentralAuth.i18n.php wgCentralAuthMessages -# php checkExtensioni18n.php --extdir /opt/mw/extensions/ -# -# BUGS: cant guess registered extensions :) -# TODO: let users set parameters to configure checklanguage.inc (it uses globals) - -// Filename for the extension i18n files database: -define( 'EXT_I18N_DB', 'i18n.db' ); - -// Global parameters for checkLanguage.inc -$wgDisplayLevel = 2; -$wgChecks = array( 'untranslated', 'obsolete', 'variables', 'empty', 'whitespace', 'xhtml', 'chars' ); - -$optionsWithArgs = array( 'extdir', 'lang' ); - -require_once( dirname(__FILE__).'/../commandLine.inc' ); -require_once( 'languages.inc' ); -require_once( 'checkLanguage.inc' ); - - -class extensionLanguages extends languages { - private $mExt18nFilename, $mExtArrayName ; - private $mExtArray; - - function __construct( $ext18nFilename, $extArrayName ) { - $this->mExt18nFilename = $ext18nFilename; - $this->mExtArrayName = $extArrayName; - - $this->mIgnoredMessages = array(); - $this->mOptionalMessages = array(); - - if ( file_exists( $this->mExt18nFilename ) ) { - require_once( $this->mExt18nFilename ); - - $foundarray = false; - if( isset( ${$this->mExtArrayName} ) ) { - // File provided in the db file - $foundarray = ${$this->mExtArrayName}; - } else { - - /* For extensions included elsewhere. For some reason other extensions - * break with the global statement, so recheck here. - */ - global ${$this->mExtArrayName}; - if( is_array( ${$this->mExtArrayName} ) ) { - $foundarray = ${$this->mExtArrayName}; - } - - /* we might have been given a function name, test it too */ - if( function_exists( $this->mExtArrayName ) ) { - // Load data - $funcName = $this->mExtArrayName ; - $foundarray = $funcName(); - } - - if(!$foundarray) { - // Provided array could not be found we try to guess it. - - # Using the extension path ($m[1]) and filename ($m[2]): - $m = array(); - preg_match( '%.*/(.*)/(.*).i18n\.php%', $this->mExt18nFilename, $m); - $arPathCandidate = 'wg' . $m[1].'Messages'; - $arFileCandidate = 'wg' . $m[2].'Messages'; - $funcCandidate = "ef{$m[2]}Messages"; - - // Try them: - if( isset($$arPathCandidate) && is_array( $$arPathCandidate ) ) { - print "warning> messages from guessed path array \$$arPathCandidate.\n"; - $foundarray = $$arPathCandidate; - } elseif( isset($$arFileCandidate) && is_array( $$arFileCandidate ) ) { - print "warning> messages from guessed file array \$$arFileCandidate.\n"; - $foundarray = $$arFileCandidate; - } elseif( function_exists( $funcCandidate ) ) { - print "warning> messages build from guessed function {$funcCandidate}().\n"; - $foundarray = $funcCandidate(); - } - } - - # We are unlucky, return empty stuff - if(!$foundarray) { - print "ERROR> failed to guess an array to use.\n"; - $this->mExtArray = null; - $this->mLanguages = null; - return; - } - } - - $this->mExtArray = $foundarray ; - $this->mLanguages = array_keys( $this->mExtArray ); - } else { - wfDie( "File $this->mExt18nFilename not found\n" ); - } - } - - protected function loadRawMessages( $code ) { - if ( isset( $this->mRawMessages[$code] ) ) { - return; - } - if( isset( $this->mExtArray[$code] ) ) { - $this->mRawMessages[$code] = $this->mExtArray[$code] ; - } else { - $this->mRawMessages[$code] = array(); - } - } - - public function getLanguages() { - return $this->mLanguages; - } -} - -/** - * @param $filename Filename containing the extension i18n - * @param $arrayname The name of the array in the filename - * @param $filter Optional, restrict check to a given language code (default; null) - */ -function checkExtensionLanguage( $filename, $arrayname, $filter = null ) { - global $wgGeneralMessages, $wgRequiredMessagesNumber; - - $extLanguages = new extensionLanguages($filename, $arrayname); - - // Stuff needed by the checkLanguage routine (globals) - $wgGeneralMessages = $extLanguages->getGeneralMessages(); - $wgRequiredMessagesNumber = count( $wgGeneralMessages['required'] ); - - $langs = $extLanguages->getLanguages(); - if( !$langs ) { - print "ERROR> \$$arrayname array does not exist.\n"; - return false; - } - - $nErrors = 0; - if( $filter ) { - $nErrors += checkLanguage( $extLanguages, $filter ); - } else { - print "Will check ". count($langs) . " languages : " . implode(' ', $langs) .".\n"; - foreach( $langs as $lang ) { - if( $lang == 'en' ) { - #print "Skipped english language\n"; - continue; - } - - $nErrors += checkLanguage( $extLanguages, $lang ); - } - } - - return $nErrors; -} - -/** - * Read the db file, parse it, start the check. - */ -function checkExtensionRepository( $extdir, $db ) { - $fh = fopen( $extdir. '/' . $db, 'r' ); - - $line_number = 0; - while( $line = fgets( $fh ) ) { - $line_number++; - - // Ignore comments - if( preg_match( '/^#/', $line ) ) { - continue; - } - - // Load data from i18n database - $data = split( ' ', chop($line) ); - $i18n_file = @$data[0]; - $arrayname = @$data[1]; - - print "------------------------------------------------------\n"; - print "Checking $i18n_file (\$$arrayname).\n"; - - // Check data - if( !file_exists( $extdir . '/' . $i18n_file ) ) { - print "ERROR> $i18n_file not found ($db:$line_number).\n"; - continue; - } -# if( $arrayname == '' ) { -# print "warning> no array name for $i18n_file ($db:$line_number).\n"; -# } - - $i18n_file = $extdir . '/' . $i18n_file ; - - global $myLang; - $nErrors = checkExtensionLanguage( $i18n_file, $arrayname, $myLang ); - if($nErrors == 1 ) { - print "\nFound $nErrors error for this extension.\n"; - } elseif($nErrors) { - print "\nFound $nErrors errors for this extension.\n"; - } else { - print "Looks OK.\n"; - } - - print "\n"; - } -} - - -function usage() { -// Usage -print <<<END -Usage: - php checkExtensioni18n.php <filename> <arrayname> - php checkExtensioni18n.php --extdir <extension repository> - -Common option: - --lang <language code> : only check the given language. - - -END; -die; -} - -// Play with options and arguments -$myLang = isset($options['lang']) ? $options['lang'] : null; - -if( isset( $options['extdir'] ) ) { - $extdb = $options['extdir'] . '/' . EXT_I18N_DB ; - - if( file_exists( $extdb ) ) { - checkExtensionRepository( $options['extdir'], EXT_I18N_DB ); - } else { - print "$extdb does not exist\n"; - } - -} else { - // Check arguments - if ( isset( $argv[0] ) ) { - - if (file_exists( $argv[0] ) ) { - $filename = $argv[0]; - } else { - print "Unable to open file '{$argv[0]}'\n"; - usage(); - } - - if ( isset( $argv[1] ) ) { - $arrayname = $argv[1]; - } else { - print "You must give an array name to be checked\n"; - usage(); - } - - global $myLang; - checkExtensionLanguage( $filename, $arrayname, $myLang ); - } else { - usage(); - } -} - -?> diff --git a/maintenance/language/checktrans.php b/maintenance/language/checktrans.php deleted file mode 100644 index a5772d47..00000000 --- a/maintenance/language/checktrans.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * @package MediaWiki - * @subpackage Maintenance - * Check to see if all messages have been translated into the selected language. - * To run this script, you must have a working installation, and you can specify - * a language, or the script will check the installation language. - */ - -/** */ -require_once(dirname(__FILE__).'/../commandLine.inc'); - -if ( isset( $args[0] ) ) { - $code = $args[0]; -} else { - $code = $wgLang->getCode(); -} - -if ( $code == 'en' ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} - -$filename = Language::getMessagesFileName( $code ); -if ( file_exists( $filename ) ) { - require( $filename ); -} else { - $messages = array(); -} - -$count = $total = 0; -$wgEnglishMessages = Language::getMessagesFor( 'en' ); -$wgLocalMessages = $messages; - -foreach ( $wgEnglishMessages as $key => $msg ) { - ++$total; - if ( !isset( $wgLocalMessages[$key] ) ) { - print "'{$key}' => \"$msg\",\n"; - ++$count; - } -} - -print "{$count} messages of {$total} are not translated in the language {$code}.\n"; -?> diff --git a/maintenance/language/duplicatetrans.php b/maintenance/language/duplicatetrans.php deleted file mode 100644 index 9273ee6e..00000000 --- a/maintenance/language/duplicatetrans.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Prints out messages that are the same as the message with the corrisponding - * key in the English file - * - * @package MediaWiki - * @subpackage Maintenance - */ - -require_once(dirname(__FILE__).'/../commandLine.inc'); - -if ( isset( $args[0] ) ) { - $code = $args[0]; -} else { - $code = $wgLang->getCode(); -} - -if ( $code == 'en' ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} - -$filename = Language::getMessagesFileName( $code ); -if ( file_exists( $filename ) ) { - require( $filename ); -} else { - $messages = array(); -} - -$count = $total = 0; -$wgEnglishMessages = Language::getMessagesFor( 'en' ); -$wgLocalMessages = $messages; - -foreach ( $wgLocalMessages as $key => $msg ) { - ++$total; - if ( @$wgEnglishMessages[$key] == $msg ) { - echo "* $key\n"; - ++$count; - } -} - -echo "{$count} messages of {$total} are duplicates in the language {$code}\n"; -?> diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 50d45e6e..d99f2e45 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -979,6 +979,7 @@ $wgMessageStructure = array( 'illegalfilename', 'badfilename', 'filetype-badmime', + 'filetype-bad-ie-mime', 'filetype-unwanted-type', 'filetype-banned-type', 'filetype-missing', @@ -1506,6 +1507,8 @@ $wgMessageStructure = array( 'undelete-missing-filearchive', 'undelete-error-short', 'undelete-error-long', + 'undelete-show-file-confirm', + 'undelete-show-file-submit', ), 'nsform' => array( 'namespace', @@ -1749,6 +1752,8 @@ $wgMessageStructure = array( 'import-nonewrevisions', 'xml-error-string', 'import-upload', + 'import-token-mismatch', + 'import-invalid-interwiki', ), 'importlog' => array( 'importlogpage', diff --git a/maintenance/language/splitLanguageFiles.inc b/maintenance/language/splitLanguageFiles.inc deleted file mode 100644 index a57744bd..00000000 --- a/maintenance/language/splitLanguageFiles.inc +++ /dev/null @@ -1,1167 +0,0 @@ -<?php -/** - * This is an experimental list. It will later be used with a script to split - * the languages files in several parts then the message system will only load - * in memory the parts which are actually needed. - * - * Generated using: grep -r foobar * - * - * $commonMsg is the default array. Other arrays will only be loaded if needed. - */ -$installerMsg = array ( -'mainpagetext', -'mainpagedocfooter', -); - -$ActionMsg = array ( -'delete' => array( - 'delete', - 'deletethispage', - 'undelete_short1', - 'undelete_short', - 'undelete', - 'undeletepage', - 'undeletepagetext', - 'undeletearticle', - 'undeleterevisions', - 'undeletehistory', - 'undeleterevision', - 'undeletebtn', - 'undeletedarticle', - 'undeletedrevisions', - 'undeletedtext', - ), -'move' => array( - 'move', - 'movethispage', -), -'revert' => array( - -), -'protect' => array( - 'confirmprotect', - 'confirmprotecttext', - 'confirmunprotect', - 'confirmunprotecttext', - 'protect', - 'protectcomment', - 'protectmoveonly', - 'protectpage', - 'protectsub', - 'protectthispage', - 'unprotect', - 'unprotectthispage', - 'unprotectsub', - 'unprotectcomment', -), -); - -$CreditsMsg = array( -'anonymous', -'siteuser', -'lastmodifiedby', -'and', -'othercontribs', -'others', -'siteusers', -'creditspage', -'nocredits', -); - -// When showing differences -$DifferenceMsg = array( -'previousdiff', -'nextdiff', -); - -// used on page edition -$EditMsg = array( -'bold_sample', -'bold_tip', -'italic_sample', -'italic_tip', -'link_sample', -'link_tip', -'extlink_sample', -'extlink_tip', -'headline_sample', -'headline_tip', -'math_sample', -'math_tip', -'nowiki_sample', -'nowiki_tip', -'image_sample', -'image_tip', -'media_sample', -'media_tip', -'sig_tip', -'hr_tip', - -'accesskey-search', -'accesskey-minoredit', -'accesskey-save', -'accesskey-preview', -'accesskey-diff', -'accesskey-compareselectedversions', -'tooltip-search', -'tooltip-minoredit', -'tooltip-save', -'tooltip-preview', -'tooltip-diff', -'tooltip-compareselectedversions', -'tooltip-watch', - -'copyrightwarning', -'copyrightwarning2', -'editconflict', -'editing', -'editingcomment', -'editingold', -'editingsection', -'explainconflict', -'infobox', -'infobox_alert', -'longpagewarning', -'nonunicodebrowser', -'previewconflict', -'previewnote', -'protectedpagewarning', -'readonlywarning', -'spamprotectiontitle', -'spamprotectiontext', -'spamprotectionmatch', -'templatesused', -'yourdiff', -'yourtext', -); - -// Per namespace -$NamespaceCategory = array ( -'category_header', -'categoryarticlecount', -'categoryarticlecount1', -'listingcontinuesabbrev', -'subcategories', -'subcategorycount', -'subcategorycount1', -'usenewcategorypage', -); - -$NamespaceImage = array ( -'deletedrevision', -'edit-externally', -'edit-externally-help', -'showbigimage', -); - -$NamespaceSpecialMsg = array( -'nosuchspecialpage', -'nospecialpagetext', -); - - - -// per special pages -$SpecialAllMessages = array( -'allmessages', -'allmessagesname', -'allmessagesdefault', -'allmessagescurrent', -'allmessagestext', -'allmessagesnotsupportedUI', -'allmessagesnotsupportedDB', -); - - -$SpecialAllPages = array( -'articlenamespace', -'allpagesformtext1', -'allpagesformtext2', -'allarticles', -'allpagesprev', -'allpagesnext', -'allpagesnamespace', -'allpagessubmit', -); - - -$SpecialAskSQLMsg = array( -'asksql', -'asksqltext', -'sqlislogged', -'sqlquery', -'querybtn', -'selectonly', -'querysuccessful', -); - -$SpecialBlockip = array( -'blockip', -'blockiptext', -'range_block_disabled', -'ipb_expiry_invalid', -'ip_range_invalid', -'ipbexpiry', -'ipbsubmit', -); - -$SpecialContributions = array( -'contribsub', -'contributionsall', -'newbies', -'nocontribs', -'ucnote', -'uclinks', -'uctop', -); - -$SpecialExportMsg = array ( -'export', -'exporttext', -'exportcuronly', -); - -$SpecialImagelist = array( -'imagelistall', -); - -$SpecialImportMsg = array ( -'import', -'importtext', -'importfailed', -'importnotext', -'importsuccess', -'importhistoryconflict', -); - -$SpecialLockdbMsg = array( -'lockdb', -'unlockdb', -'lockdbtext', -'unlockdbtext', -'lockconfirm', -'unlockconfirm', -'lockbtn', -'unlockbtn', -'locknoconfirm', -'lockdbsuccesssub', -'unlockdbsuccesssub', -'lockdbsuccesstext', -'unlockdbsuccesstext', -); - -$SpecialLogMsg = array( -'specialloguserlabel', -'speciallogtitlelabel', -); - -$SpecialMaintenance = array( -'maintenance', -'maintnancepagetext', -'maintenancebacklink', -'disambiguations', -'disambiguationspage', -'disambiguationstext', -'doubleredirects', -'doubleredirectstext', -'brokenredirects', -'brokenredirectstext', -'selflinks', -'selflinkstext', -'mispeelings', -'mispeelingstext', -'mispeelingspage', -'missinglanguagelinks', -'missinglanguagelinksbutton', -'missinglanguagelinkstext', -); - -$SpecialMakeSysopMsg = array ( -'already_bureaucrat', -'already_sysop', -'makesysop', -'makesysoptitle', -'makesysoptext', -'makesysopname', -'makesysopsubmit', -'makesysopok', -'makesysopfail', -'rights', -'set_rights_fail', -'set_user_rights', -'user_rights_set', -); - -$SpecialMovepageMsg = array( -'newtitle', -'movearticle', -'movenologin', -'movenologintext', -'movepage', -'movepagebtn', -'movepagetalktext', -'movepagetext', -'movetalk', -'pagemovedsub', -'pagemovedtext', -'talkexists', -'talkpagemoved', -'talkpagenotmoved', - -); - -$SpecialPreferencesMsg = array( -'tog-underline', -'tog-highlightbroken', -'tog-justify', -'tog-hideminor', -'tog-usenewrc', -'tog-numberheadings', -'tog-showtoolbar', -'tog-editondblclick', -'tog-editsection', -'tog-editsectiononrightclick', -'tog-showtoc', -'tog-rememberpassword', -'tog-editwidth', -'tog-watchdefault', -'tog-minordefault', -'tog-previewontop', -'tog-previewonfirst', -'tog-nocache', -'tog-enotifwatchlistpages', -'tog-enotifusertalkpages', -'tog-enotifminoredits', -'tog-enotifrevealaddr', -'tog-shownumberswatching', -'tog-rcusemodstyle', -'tog-showupdated', -'tog-fancysig', -'tog-externaleditor', - -'imagemaxsize', -'prefs-help-email', -'prefs-help-email-enotif', -'prefs-help-realname', -'prefs-help-userdata', -'prefs-misc', -'prefs-personal', -'prefs-rc', -'resetprefs', -'saveprefs', -'oldpassword', -'newpassword', -'retypenew', -'textboxsize', -'rows', -'columns', -'searchresultshead', -'resultsperpage', -'contextlines', -'contextchars', -'stubthreshold', -'recentchangescount', -'savedprefs', -'timezonelegend', -'timezonetext', -'localtime', -'timezoneoffset', -'servertime', -'guesstimezone', -'emailflag', -'defaultns', -'default', -); - -$SpecialRecentchangesMsg = array( -'changes', -'recentchanges', -'recentchanges-url', -'recentchangestext', -'rcloaderr', -'rcnote', -'rcnotefrom', -'rclistfrom', -'showhideminor', -'rclinks', -'rchide', -'rcliu', -'diff', -'hist', -'hide', -'show', -'tableform', -'listform', -'nchanges', -'minoreditletter', -'newpageletter', -'sectionlink', -'number_of_watching_users_RCview', -'number_of_watching_users_pageview', -'recentchangesall', -); - -$SpecialRecentchangeslinkedMsg = array( -'rclsub', -); - -$SpecialSearchMsg = array( -'searchresults', -'searchresulttext', -'searchquery', -'badquery', -'badquerytext', -'matchtotals', -'nogomatch', -'titlematches', -'notitlematches', -'textmatches', -'notextmatches', -); - -$SpecialSitesettingsMsg = array( -'sitesettings', -'sitesettings-features', -'sitesettings-permissions', -'sitesettings-memcached', -'sitesettings-debugging', -'sitesettings-caching', -'sitesettings-wgShowIPinHeader', -'sitesettings-wgUseDatabaseMessages', -'sitesettings-wgUseCategoryMagic', -'sitesettings-wgUseCategoryBrowser', -'sitesettings-wgHitcounterUpdateFreq', -'sitesettings-wgAllowExternalImages', -'sitesettings-permissions-readonly', -'sitesettings-permissions-whitelist', -'sitesettings-permissions-banning', -'sitesettings-permissions-miser', -'sitesettings-wgReadOnly', -'sitesettings-wgReadOnlyFile', -'sitesettings-wgWhitelistEdit', -'sitesettings-wgWhitelistRead', -'sitesettings-wgWhitelistAccount-user', -'sitesettings-wgWhitelistAccount-sysop', -'sitesettings-wgWhitelistAccount-developer', -'sitesettings-wgSysopUserBans', -'sitesettings-wgSysopRangeBans', -'sitesettings-wgDefaultBlockExpiry', -'sitesettings-wgMiserMode', -'sitesettings-wgDisableQueryPages', -'sitesettings-wgUseWatchlistCache', -'sitesettings-wgWLCacheTimeout', -'sitesettings-cookies', -'sitesettings-performance', -'sitesettings-images', -); - -$SpecialStatisticsMsg = array( -'statistics', -'sitestats', -'userstats', -'sitestatstext', -'userstatstext', -); - -$SpecialUndelte = array( -'deletepage', -); - -$SpecialUploadMsg = array( -'affirmation', -'badfilename', -'badfiletype', -'emptyfile', -'fileexists', -'filedesc', -'filename', -'filesource', -'filestatus', -'fileuploaded', -'ignorewarning', -'illegalfilename', -'largefile', -'minlength', -'noaffirmation', -'reupload', -'reuploaddesc', -'savefile', -'successfulupload', -'upload', -'uploadbtn', -'uploadcorrupt', -'uploaddisabled', -'uploadfile', -'uploadedimage', -'uploaderror', -'uploadlink', -'uploadlog', -'uploadlogpage', -'uploadlogpagetext', -'uploadnologin', -'uploadnologintext', -'uploadtext', -'uploadwarning', -); - -$SpecialUserlevelsMsg = array( -'saveusergroups', -'userlevels-editusergroup', -'userlevels-groupsavailable', -'userlevels-groupshelp', -'userlevels-groupsmember', -); - -$SpecialUserloginMsg = array( -'acct_creation_throttle_hit', -'loginend', -'loginsuccesstitle', -'loginsuccess', -'nocookiesnew', -'nocookieslogin', -'noemail', -'noname', -'nosuchuser', -'mailmypassword', -'mailmypasswordauthent', -'passwordremindermailsubject', -'passwordremindermailbody', -'passwordsent', -'passwordsentforemailauthentication', -'userexists', -'wrongpassword', -); - -$SpecialValidateMsg = array( -'val_yes', -'val_no', -'val_revision', -'val_time', -'val_list_header', -'val_add', -'val_del', -'val_warning', -'val_rev_for', -'val_rev_stats_link', -'val_iamsure', -'val_clear_old', -'val_merge_old', -'val_form_note', -'val_noop', -'val_percent', -'val_percent_single', -'val_total', -'val_version', -'val_tab', -'val_this_is_current_version', -'val_version_of', -'val_table_header', -'val_stat_link_text', -'val_view_version', -'val_validate_version', -'val_user_validations', -'val_no_anon_validation', -'val_validate_article_namespace_only', -'val_validated', -'val_article_lists', -'val_page_validation_statistics', -); - -$SpecialVersionMsg = array( -'special_version_prefix', -'special_version_postfix' -); - -$SpecialWatchlistMsg = array( -'watchlistall1', -'watchlistall2', -'wlnote', -'wlshowlast', -'wlsaved', -'wlhideshowown', -'wlshow', -'wlhide', -); - -$SpecialWhatlinkshereMsg = array( -'linklistsub', -'nolinkshere', -'isredirect', -); - - -$commonMsg = array ( -'sunday', -'monday', -'tuesday', -'wednesday', -'thursday', -'friday', -'saturday', -'january', -'february', -'march', -'april', -'may_long', -'june', -'july', -'august', -'september', -'october', -'november', -'december', -'jan', -'feb', -'mar', -'apr', -'may', -'jun', -'jul', -'aug', -'sep', -'oct', -'nov', -'dec', -'categories', -'category', -'linktrail', -'mainpage', -'portal', -'portal-url', -'about', -'aboutsite', -'aboutpage', -'article', -'help', -'helppage', -'wikititlesuffix', -'bugreports', -'bugreportspage', -'sitesupport', -'sitesupport-url', -'faq', -'faqpage', -'edithelp', -'newwindow', -'edithelppage', -'cancel', -'qbfind', -'qbbrowse', -'qbedit', -'qbpageoptions', -'qbpageinfo', -'qbmyoptions', -'qbspecialpages', -'moredotdotdot', -'mypage', -'mytalk', -'anontalk', -'navigation', -'metadata', -'metadata_page', -'currentevents', -'currentevents-url', -'disclaimers', -'disclaimerpage', -'errorpagetitle', -'returnto', -'tagline', -'whatlinkshere', -'search', -'go', -'history', -'history_short', -'info_short', -'printableversion', -'edit', -'editthispage', -'newpage', -'talkpage', -'specialpage', -'personaltools', -'postcomment', -'addsection', -'articlepage', -'subjectpage', -'talk', -'toolbox', -'userpage', -'wikipediapage', -'imagepage', -'viewtalkpage', -'otherlanguages', -'redirectedfrom', -'lastmodified', -'viewcount', -'copyright', -'poweredby', -'printsubtitle', -'protectedpage', -'administrators', -'sysoptitle', -'sysoptext', -'developertitle', -'developertext', -'bureaucrattitle', -'bureaucrattext', -'nbytes', -'ok', -'sitetitle', -'pagetitle', -'sitesubtitle', -'retrievedfrom', -'newmessages', -'newmessageslink', -'editsection', -'toc', -'showtoc', -'hidetoc', -'thisisdeleted', -'restorelink', -'feedlinks', -'sitenotice', -'nstab-main', -'nstab-user', -'nstab-media', -'nstab-special', -'nstab-wp', -'nstab-image', -'nstab-mediawiki', -'nstab-template', -'nstab-help', -'nstab-category', -'nosuchaction', -'nosuchactiontext', - - -'error', -'databaseerror', -'dberrortext', -'dberrortextcl', -'noconnect', -'nodb', -'cachederror', -'laggedslavemode', -'readonly', -'enterlockreason', -'readonlytext', -'missingarticle', -'internalerror', -'filecopyerror', -'filerenameerror', -'filedeleteerror', -'filenotfound', -'unexpected', -'formerror', -'badarticleerror', -'cannotdelete', -'badtitle', -'badtitletext', -'perfdisabled', -'perfdisabledsub', -'perfcached', -'wrong_wfQuery_params', -'viewsource', -'protectedtext', -'seriousxhtmlerrors', -'logouttitle', -'logouttext', -'welcomecreation', - -'loginpagetitle', -'yourname', -'yourpassword', -'yourpasswordagain', -'newusersonly', -'remembermypassword', -'loginproblem', -'alreadyloggedin', -'login', -'loginprompt', -'userlogin', -'logout', -'userlogout', -'notloggedin', -'createaccount', -'createaccountmail', -'badretype', - -'youremail', -'yourrealname', -'yourlanguage', -'yourvariant', -'yournick', -'emailforlost', -'loginerror', -'nosuchusershort', - -'mailerror', -'emailauthenticated', -'emailnotauthenticated', -'invalidemailaddress', -'disableduntilauthent', -'disablednoemail', - -'summary', -'subject', -'minoredit', -'watchthis', -'savearticle', -'preview', -'showpreview', -'showdiff', -'blockedtitle', -'blockedtext', -'whitelistedittitle', -'whitelistedittext', -'whitelistreadtitle', -'whitelistreadtext', -'whitelistacctitle', -'whitelistacctext', -'loginreqtitle', -'loginreqtext', -'accmailtitle', -'accmailtext', -'newarticle', -'newarticletext', -'talkpagetext', -'anontalkpagetext', -'noarticletext', -'clearyourcache', -'usercssjsyoucanpreview', -'usercsspreview', -'userjspreview', -'updated', -'note', -'storedversion', // not used ? Editpage ? -'revhistory', -'nohistory', -'revnotfound', -'revnotfoundtext', -'loadhist', -'currentrev', -'revisionasof', -'revisionasofwithlink', -'previousrevision', -'nextrevision', -'currentrevisionlink', -'cur', -'next', -'last', -'orig', -'histlegend', -'history_copyright', -'difference', -'loadingrev', -'lineno', -'editcurrent', -'selectnewerversionfordiff', -'selectolderversionfordiff', -'compareselectedversions', - -'prevn', -'nextn', -'viewprevnext', -'showingresults', -'showingresultsnum', -'nonefound', -'powersearch', -'powersearchtext', -'searchdisabled', -'googlesearch', -'blanknamespace', -'preferences', -'prefsnologin', -'prefsnologintext', -'prefslogintext', -'prefsreset', -'qbsettings', -'qbsettingsnote', -'changepassword', -'skin', -'math', -'dateformat', - -'math_failure', -'math_unknown_error', -'math_unknown_function', -'math_lexing_error', -'math_syntax_error', -'math_image_error', -'math_bad_tmpdir', -'math_bad_output', -'math_notexvc', - - - - - - -'grouplevels-lookup-group', -'grouplevels-group-edit', -'editgroup', -'addgroup', -'userlevels-lookup-user', -'userlevels-user-editname', -'editusergroup', -'grouplevels-editgroup', -'grouplevels-addgroup', -'grouplevels-editgroup-name', -'grouplevels-editgroup-description', -'savegroup', - -// common to several pages -'copyrightpage', -'copyrightpagename', -'imagelist', -'imagelisttext', -'ilshowmatch', -'ilsubmit', -'showlast', -'byname', -'bydate', -'bysize', - - - -'imgdelete', -'imgdesc', -'imglegend', -'imghistory', -'revertimg', -'deleteimg', -'deleteimgcompletely', -'imghistlegend', -'imagelinks', -'linkstoimage', -'nolinkstoimage', - -// unused ?? -'uploadedfiles', -'getimagelist', - - -'sharedupload', -'shareduploadwiki', - -// Special pages names -'orphans', -'geo', -'validate', -'lonelypages', -'uncategorizedpages', -'uncategorizedcategories', -'unusedimages', -'popularpages', -'nviews', -'wantedpages', -'nlinks', -'allpages', -'randompage', -'randompage-url', -'shortpages', -'longpages', -'deadendpages', -'listusers', -'specialpages', -'spheading', -'restrictedpheading', -'recentchangeslinked', - - -'debug', -'newpages', -'ancientpages', -'intl', -'unusedimagestext', -'booksources', -'categoriespagetext', -'data', -'userlevels', -'grouplevels', -'booksourcetext', -'isbn', -'rfcurl', -'pubmedurl', -'alphaindexline', -'version', -'log', -'alllogstext', -'nextpage', -'mailnologin', -'mailnologintext', -'emailuser', -'emailpage', -'emailpagetext', -'usermailererror', -'defemailsubject', -'noemailtitle', -'noemailtext', -'emailfrom', -'emailto', -'emailsubject', -'emailmessage', -'emailsend', -'emailsent', -'emailsenttext', -'watchlist', -'watchlistsub', -'nowatchlist', -'watchnologin', -'watchnologintext', -'addedwatch', -'addedwatchtext', -'removedwatch', -'removedwatchtext', -'watch', -'watchthispage', -'unwatch', -'unwatchthispage', -'notanarticle', -'watchnochange', -'watchdetails', -'watchmethod-recent', -'watchmethod-list', -'removechecked', -'watchlistcontains', -'watcheditlist', -'removingchecked', -'couldntremove', -'iteminvalidname', - -'updatedmarker', -'email_notification_mailer', -'email_notification_infotext', -'email_notification_reset', -'email_notification_newpagetext', -'email_notification_to', -'email_notification_subject', -'email_notification_lastvisitedrevisiontext', -'email_notification_body', - -'confirm', -'excontent', -'exbeforeblank', -'exblank', -'confirmdelete', -'deletesub', -'historywarning', -'confirmdeletetext', -'actioncomplete', -'deletedtext', -'deletedarticle', -'dellogpage', -'dellogpagetext', -'deletionlog', -'reverted', -'deletecomment', -'imagereverted', -'rollback', -'rollback_short', -'rollbacklink', -'rollbackfailed', -'cantrollback', -'alreadyrolled', -'revertpage', -'editcomment', -'sessionfailure', - -'protectlogpage', -'protectlogtext', - -'protectedarticle', -'unprotectedarticle', - -'contributions', -'mycontris', -'notargettitle', // not used ? -'notargettext', // not used ? - -'linkshere', - -'ipaddress', -'ipadressorusername', // not used ? -'ipbreason', - -'badipaddress', -'noblockreason', -'blockipsuccesssub', -'blockipsuccesstext', -'unblockip', -'unblockiptext', -'ipusubmit', -'ipusuccess', -'ipblocklist', -'blocklistline', -'blocklink', -'unblocklink', -'contribslink', -'autoblocker', -'blocklogpage', -'blocklogentry', -'blocklogtext', -'unblocklogentry', // not used ? - -'proxyblocker', -'proxyblockreason', -'proxyblocksuccess', -'sorbs', -'sorbsreason', - -'setbureaucratflag', -'bureaucratlog', -'rightslogtext', -'bureaucratlogentry', - -'articleexists', // not used ? - -'movedto', -'1movedto2', -'1movedto2_redir', -'movelogpage', -'movelogpagetext', - -'thumbnail-more', -'filemissing', -'monobook.css', -'nodublincore', -'nocreativecommons', -'notacceptable', - -// used in Article:: -'infosubtitle', -'numedits', -'numtalkedits', -'numwatchers', -'numauthors', -'numtalkauthors', - -// not used ? -'mw_math_png', -'mw_math_simple', -'mw_math_html', -'mw_math_source', -'mw_math_modern', -'mw_math_mathml', - -// Patrolling -'markaspatrolleddiff', -'markaspatrolledlink', -'markaspatrolledtext', -'markedaspatrolled', -'markedaspatrolledtext', -'rcpatroldisabled', // not used ? -'rcpatroldisabledtext', // not used ? - -'monobook.js', -'newimages', -'noimages', -'variantname-zh-cn', -'variantname-zh-tw', -'variantname-zh-hk', -'variantname-zh-sg', -'variantname-zh', -'zhconversiontable', -'passwordtooshort', // sp preferences / userlogin -); -?> diff --git a/maintenance/language/splitLanguageFiles.php b/maintenance/language/splitLanguageFiles.php deleted file mode 100644 index d1ce6e7e..00000000 --- a/maintenance/language/splitLanguageFiles.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * splitLanguageFiles - * Should read each of the languages files then split them in several subpart - * under ./languages/XX/ according to the arrays in splitLanguageFiles.inc . - * - * Also need to rewrite the wfMsg system / message-cache. - */ - -include(dirname(__FILE__).'/../commandLine.inc'); - - - diff --git a/maintenance/language/unusedMessages.php b/maintenance/language/unusedMessages.php deleted file mode 100644 index 8b117eca..00000000 --- a/maintenance/language/unusedMessages.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Prints out messages in localisation files that are no longer used. - * - * @package MediaWiki - * @subpackage Maintenance - */ - -require_once(dirname(__FILE__).'/../commandLine.inc'); - -if ( isset( $args[0] ) ) { - $code = $args[0]; -} else { - $code = $wgLang->getCode(); -} - -if ( $code == 'en' ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} - -$filename = Language::getMessagesFileName( $code ); -if ( file_exists( $filename ) ) { - require( $filename ); -} else { - $messages = array(); -} - -$count = $total = 0; -$wgEnglishMessages = Language::getMessagesFor( 'en' ); -$wgLocalMessages = $messages; - -foreach ( $wgLocalMessages as $key => $msg ) { - ++$total; - if ( !isset( $wgEnglishMessages[$key] ) ) { - print "* $key\n"; - ++$count; - } -} - -print "{$count} messages of {$total} are unused in the language {$code}\n"; -?> diff --git a/maintenance/languages.inc b/maintenance/languages.inc deleted file mode 100644 index e318259d..00000000 --- a/maintenance/languages.inc +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Library to grab data from languages files - * - * WORK IN PROGRESS. There is some bugs when including the same - * file multiple time :((( - */ -require_once('commandLine.inc'); - -class languages { - /** Contain the list of languages available */ - var $list = array(); - /** some messages for the current lang */ - var $messages = array(); - - function languages() { - $this->clear(); - $this->loadList(); - } - - function clear() { - $this->list = array(); - $this->messages = array(); - } - - function loadList() { - global $IP; - $this->list = array(); - - // available language files - $dir = opendir("$IP/languages"); - while ($file = readdir($dir)) { - if (preg_match("/Language([^.]*?)\.php$/", $file, $m)) { - $this->list[] = $m[1]; - } - } - sort($this->list); - - // Cleanup file list - foreach($this->list as $key => $lang) { - if ($lang == 'Utf8' || $lang == '' || $lang == 'Converter') - unset($this->list[$key]); - } - } - - function getList() { return $this->list; } -} -?> diff --git a/maintenance/mwdoxygen.cfg b/maintenance/mwdoxygen.cfg deleted file mode 100644 index b5ba8925..00000000 --- a/maintenance/mwdoxygen.cfg +++ /dev/null @@ -1,230 +0,0 @@ -# Doxyfile 1.5.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = MediaWiki -PROJECT_NUMBER = MW_VERSION_PLACEHOLDER -OUTPUT_DIRECTORY = docs -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = YES -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = YES -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = YES -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -BUILTIN_STL_SUPPORT = NO -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES -FILE_VERSION_FILTER = bin/svnstat -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = config \ - includes \ - maintenance \ - skins \ - tests -FILE_PATTERNS = *.php \ - *.inc -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = NO -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = NO -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = YES diff --git a/maintenance/mysql5/tables-binary.sql b/maintenance/mysql5/tables-binary.sql deleted file mode 100644 index 2ab36546..00000000 --- a/maintenance/mysql5/tables-binary.sql +++ /dev/null @@ -1,1095 +0,0 @@ --- Experimental table definitions for MySQL 4.1 and 5.0 with --- content-holding fields switched to explicit binary charset. --- --- Binary is used instead of UTF-8 or UCS-2 so that all of --- Unicode may be used as UTF-8 (MySQL still does not allow --- use of characters outside the BMP in UTF-8 and has no UTF-16 --- support). --- --- This should provide compatibility with our current MySQL 4.0 --- behavior (safe for full UTF-8, but ugly sorting) on newer --- versions of MySQL server, without the conversion surprises --- you get from piggybacking on "Latin-1" fields. --- --- UTF-8 is used for the searchindex fields, as the fulltext index --- doesn't seem to like the binary encoding. --- --- Not fully tested, may have surprises! --- --- TODO: Test various fields - --- ------------------------------------------------------------ - --- SQL to create the initial tables for the MediaWiki database. --- This is read and executed by the install script; you should --- not have to run it by itself unless doing a manual install. - --- --- General notes: --- --- If possible, create tables as InnoDB to benefit from the --- superior resiliency against crashes and ability to read --- during writes (and write during reads!) --- --- Only the 'searchindex' table requires MyISAM due to the --- requirement for fulltext index support, which is missing --- from InnoDB. --- --- --- The MySQL table backend for MediaWiki currently uses --- 14-character CHAR or VARCHAR fields to store timestamps. --- The format is YYYYMMDDHHMMSS, which is derived from the --- text format of MySQL's TIMESTAMP fields. --- --- Historically TIMESTAMP fields were used, but abandoned --- in early 2002 after a lot of trouble with the fields --- auto-updating. --- --- The Postgres backend uses DATETIME fields for timestamps, --- and we will migrate the MySQL definitions at some point as --- well. --- --- --- The /*$wgDBprefix*/ comments in this and other files are --- replaced with the defined table prefix by the installer --- and updater scripts. If you are installing or running --- updates manually, you will need to manually insert the --- table prefix if any when running these scripts. --- - - --- --- The user table contains basic account information, --- authentication keys, etc. --- --- Some multi-wiki sites may share a single central user table --- between separate wikis using the $wgSharedDB setting. --- --- Note that when a external authentication plugin is used, --- user table entries still need to be created to store --- preferences and to key tracking information in the other --- tables. --- -CREATE TABLE /*$wgDBprefix*/user ( - user_id int(5) unsigned NOT NULL auto_increment, - - -- Usernames must be unique, must not be in the form of - -- an IP address. _Shouldn't_ allow slashes or case - -- conflicts. Spaces are allowed, and are _not_ converted - -- to underscores like titles. See the User::newFromName() for - -- the specific tests that usernames have to pass. - user_name varchar(255) binary NOT NULL default '', - - -- Optional 'real name' to be displayed in credit listings - user_real_name varchar(255) binary NOT NULL default '', - - -- Password hashes, normally hashed like so: - -- MD5(CONCAT(user_id,'-',MD5(plaintext_password))), see - -- wfEncryptPassword() in GlobalFunctions.php - user_password tinyblob NOT NULL, - - -- When using 'mail me a new password', a random - -- password is generated and the hash stored here. - -- The previous password is left in place until - -- someone actually logs in with the new password, - -- at which point the hash is moved to user_password - -- and the old password is invalidated. - user_newpassword tinyblob NOT NULL, - - -- Timestamp of the last time when a new password was - -- sent, for throttling purposes - user_newpass_time char(14) binary, - - -- Note: email should be restricted, not public info. - -- Same with passwords. - user_email tinytext NOT NULL, - - -- Newline-separated list of name=value defining the user - -- preferences - user_options blob NOT NULL, - - -- This is a timestamp which is updated when a user - -- logs in, logs out, changes preferences, or performs - -- some other action requiring HTML cache invalidation - -- to ensure that the UI is updated. - user_touched char(14) binary NOT NULL default '', - - -- A pseudorandomly generated value that is stored in - -- a cookie when the "remember password" feature is - -- used (previously, a hash of the password was used, but - -- this was vulnerable to cookie-stealing attacks) - user_token char(32) binary NOT NULL default '', - - -- Initially NULL; when a user's e-mail address has been - -- validated by returning with a mailed token, this is - -- set to the current timestamp. - user_email_authenticated char(14) binary, - - -- Randomly generated token created when the e-mail address - -- is set and a confirmation test mail sent. - user_email_token char(32) binary, - - -- Expiration date for the user_email_token - user_email_token_expires char(14) binary, - - -- Timestamp of account registration. - -- Accounts predating this schema addition may contain NULL. - user_registration char(14) binary, - - -- Count of edits and edit-like actions. - -- - -- *NOT* intended to be an accurate copy of COUNT(*) WHERE rev_user=user_id - -- May contain NULL for old accounts if batch-update scripts haven't been - -- run, as well as listing deleted edits and other myriad ways it could be - -- out of sync. - -- - -- Meant primarily for heuristic checks to give an impression of whether - -- the account has been used much. - -- - user_editcount int, - - PRIMARY KEY user_id (user_id), - UNIQUE INDEX user_name (user_name), - INDEX (user_email_token) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- User permissions have been broken out to a separate table; --- this allows sites with a shared user table to have different --- permissions assigned to a user in each project. --- --- This table replaces the old user_rights field which used a --- comma-separated blob. --- -CREATE TABLE /*$wgDBprefix*/user_groups ( - -- Key to user_id - ug_user int(5) unsigned NOT NULL default '0', - - -- Group names are short symbolic string keys. - -- The set of group names is open-ended, though in practice - -- only some predefined ones are likely to be used. - -- - -- At runtime $wgGroupPermissions will associate group keys - -- with particular permissions. A user will have the combined - -- permissions of any group they're explicitly in, plus - -- the implicit '*' and 'user' groups. - ug_group char(16) NOT NULL default '', - - PRIMARY KEY (ug_user,ug_group), - KEY (ug_group) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- Stores notifications of user talk page changes, for the display --- of the "you have new messages" box -CREATE TABLE /*$wgDBprefix*/user_newtalk ( - -- Key to user.user_id - user_id int(5) NOT NULL default '0', - -- If the user is an anonymous user hir IP address is stored here - -- since the user_id of 0 is ambiguous - user_ip varchar(40) NOT NULL default '', - INDEX user_id (user_id), - INDEX user_ip (user_ip) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Core of the wiki: each page has an entry here which identifies --- it by title and contains some essential metadata. --- -CREATE TABLE /*$wgDBprefix*/page ( - -- Unique identifier number. The page_id will be preserved across - -- edits and rename operations, but not deletions and recreations. - page_id int(8) unsigned NOT NULL auto_increment, - - -- A page name is broken into a namespace and a title. - -- The namespace keys are UI-language-independent constants, - -- defined in includes/Defines.php - page_namespace int NOT NULL, - - -- The rest of the title, as text. - -- Spaces are transformed into underscores in title storage. - page_title varchar(255) binary NOT NULL, - - -- Comma-separated set of permission keys indicating who - -- can move or edit the page. - page_restrictions tinyblob NOT NULL, - - -- Number of times this page has been viewed. - page_counter bigint(20) unsigned NOT NULL default '0', - - -- 1 indicates the article is a redirect. - page_is_redirect tinyint(1) unsigned NOT NULL default '0', - - -- 1 indicates this is a new entry, with only one edit. - -- Not all pages with one edit are new pages. - page_is_new tinyint(1) unsigned NOT NULL default '0', - - -- Random value between 0 and 1, used for Special:Randompage - page_random real unsigned NOT NULL, - - -- This timestamp is updated whenever the page changes in - -- a way requiring it to be re-rendered, invalidating caches. - -- Aside from editing this includes permission changes, - -- creation or deletion of linked pages, and alteration - -- of contained templates. - page_touched char(14) binary NOT NULL default '', - - -- Handy key to revision.rev_id of the current revision. - -- This may be 0 during page creation, but that shouldn't - -- happen outside of a transaction... hopefully. - page_latest int(8) unsigned NOT NULL, - - -- Uncompressed length in bytes of the page's current source text. - page_len int(8) unsigned NOT NULL, - - PRIMARY KEY page_id (page_id), - UNIQUE INDEX name_title (page_namespace,page_title), - - -- Special-purpose indexes - INDEX (page_random), - INDEX (page_len) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Every edit of a page creates also a revision row. --- This stores metadata about the revision, and a reference --- to the text storage backend. --- -CREATE TABLE /*$wgDBprefix*/revision ( - rev_id int(8) unsigned NOT NULL auto_increment, - - -- Key to page_id. This should _never_ be invalid. - rev_page int(8) unsigned NOT NULL, - - -- Key to text.old_id, where the actual bulk text is stored. - -- It's possible for multiple revisions to use the same text, - -- for instance revisions where only metadata is altered - -- or a rollback to a previous version. - rev_text_id int(8) unsigned NOT NULL, - - -- Text comment summarizing the change. - -- This text is shown in the history and other changes lists, - -- rendered in a subset of wiki markup by Linker::formatComment() - rev_comment tinyblob NOT NULL, - - -- Key to user.user_id of the user who made this edit. - -- Stores 0 for anonymous edits and for some mass imports. - rev_user int(5) unsigned NOT NULL default '0', - - -- Text username or IP address of the editor. - rev_user_text varchar(255) binary NOT NULL default '', - - -- Timestamp - rev_timestamp char(14) binary NOT NULL default '', - - -- Records whether the user marked the 'minor edit' checkbox. - -- Many automated edits are marked as minor. - rev_minor_edit tinyint(1) unsigned NOT NULL default '0', - - -- Not yet used; reserved for future changes to the deletion system. - rev_deleted tinyint(1) unsigned NOT NULL default '0', - - PRIMARY KEY rev_page_id (rev_page, rev_id), - UNIQUE INDEX rev_id (rev_id), - INDEX rev_timestamp (rev_timestamp), - INDEX page_timestamp (rev_page,rev_timestamp), - INDEX user_timestamp (rev_user,rev_timestamp), - INDEX usertext_timestamp (rev_user_text,rev_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Holds text of individual page revisions. --- --- Field names are a holdover from the 'old' revisions table in --- MediaWiki 1.4 and earlier: an upgrade will transform that --- table into the 'text' table to minimize unnecessary churning --- and downtime. If upgrading, the other fields will be left unused. --- -CREATE TABLE /*$wgDBprefix*/text ( - -- Unique text storage key number. - -- Note that the 'oldid' parameter used in URLs does *not* - -- refer to this number anymore, but to rev_id. - -- - -- revision.rev_text_id is a key to this column - old_id int(8) unsigned NOT NULL auto_increment, - - -- Depending on the contents of the old_flags field, the text - -- may be convenient plain text, or it may be funkily encoded. - old_text mediumblob NOT NULL, - - -- Comma-separated list of flags: - -- gzip: text is compressed with PHP's gzdeflate() function. - -- utf8: text was stored as UTF-8. - -- If $wgLegacyEncoding option is on, rows *without* this flag - -- will be converted to UTF-8 transparently at load time. - -- object: text field contained a serialized PHP object. - -- The object either contains multiple versions compressed - -- together to achieve a better compression ratio, or it refers - -- to another row where the text can be found. - old_flags tinyblob NOT NULL, - - PRIMARY KEY old_id (old_id) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Holding area for deleted articles, which may be viewed --- or restored by admins through the Special:Undelete interface. --- The fields generally correspond to the page, revision, and text --- fields, with several caveats. --- -CREATE TABLE /*$wgDBprefix*/archive ( - ar_namespace int NOT NULL default '0', - ar_title varchar(255) binary NOT NULL default '', - - -- Newly deleted pages will not store text in this table, - -- but will reference the separately existing text rows. - -- This field is retained for backwards compatibility, - -- so old archived pages will remain accessible after - -- upgrading from 1.4 to 1.5. - -- Text may be gzipped or otherwise funky. - ar_text mediumblob NOT NULL, - - -- Basic revision stuff... - ar_comment tinyblob NOT NULL, - ar_user int(5) unsigned NOT NULL default '0', - ar_user_text varchar(255) binary NOT NULL, - ar_timestamp char(14) binary NOT NULL default '', - ar_minor_edit tinyint(1) NOT NULL default '0', - - -- See ar_text note. - ar_flags tinyblob NOT NULL, - - -- When revisions are deleted, their unique rev_id is stored - -- here so it can be retained after undeletion. This is necessary - -- to retain permalinks to given revisions after accidental delete - -- cycles or messy operations like history merges. - -- - -- Old entries from 1.4 will be NULL here, and a new rev_id will - -- be created on undeletion for those revisions. - ar_rev_id int(8) unsigned, - - -- For newly deleted revisions, this is the text.old_id key to the - -- actual stored text. To avoid breaking the block-compression scheme - -- and otherwise making storage changes harder, the actual text is - -- *not* deleted from the text table, merely hidden by removal of the - -- page and revision entries. - -- - -- Old entries deleted under 1.2-1.4 will have NULL here, and their - -- ar_text and ar_flags fields will be used to create a new text - -- row upon undeletion. - ar_text_id int(8) unsigned, - - KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Track page-to-page hyperlinks within the wiki. --- -CREATE TABLE /*$wgDBprefix*/pagelinks ( - -- Key to the page_id of the page containing the link. - pl_from int(8) unsigned NOT NULL default '0', - - -- Key to page_namespace/page_title of the target page. - -- The target page may or may not exist, and due to renames - -- and deletions may refer to different page records as time - -- goes by. - pl_namespace int NOT NULL default '0', - pl_title varchar(255) binary NOT NULL default '', - - UNIQUE KEY pl_from (pl_from,pl_namespace,pl_title), - KEY (pl_namespace,pl_title,pl_from) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Track template inclusions. --- -CREATE TABLE /*$wgDBprefix*/templatelinks ( - -- Key to the page_id of the page containing the link. - tl_from int(8) unsigned NOT NULL default '0', - - -- Key to page_namespace/page_title of the target page. - -- The target page may or may not exist, and due to renames - -- and deletions may refer to different page records as time - -- goes by. - tl_namespace int NOT NULL default '0', - tl_title varchar(255) binary NOT NULL default '', - - UNIQUE KEY tl_from (tl_from,tl_namespace,tl_title), - KEY (tl_namespace,tl_title,tl_from) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Track links to images *used inline* --- We don't distinguish live from broken links here, so --- they do not need to be changed on upload/removal. --- -CREATE TABLE /*$wgDBprefix*/imagelinks ( - -- Key to page_id of the page containing the image / media link. - il_from int(8) unsigned NOT NULL default '0', - - -- Filename of target image. - -- This is also the page_title of the file's description page; - -- all such pages are in namespace 6 (NS_IMAGE). - il_to varchar(255) binary NOT NULL default '', - - UNIQUE KEY il_from (il_from,il_to), - KEY (il_to,il_from) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Track category inclusions *used inline* --- This tracks a single level of category membership --- (folksonomic tagging, really). --- -CREATE TABLE /*$wgDBprefix*/categorylinks ( - -- Key to page_id of the page defined as a category member. - cl_from int(8) unsigned NOT NULL default '0', - - -- Name of the category. - -- This is also the page_title of the category's description page; - -- all such pages are in namespace 14 (NS_CATEGORY). - cl_to varchar(255) binary NOT NULL default '', - - -- The title of the linking page, or an optional override - -- to determine sort order. Sorting is by binary order, which - -- isn't always ideal, but collations seem to be an exciting - -- and dangerous new world in MySQL... - -- - -- For MySQL 4.1+ with charset set to utf8, the sort key *index* - -- needs cut to be smaller than 1024 bytes (at 3 bytes per char). - -- To sort properly on the shorter key, this field needs to be - -- the same shortness. - cl_sortkey varchar(86) binary NOT NULL default '', - - -- This isn't really used at present. Provided for an optional - -- sorting method by approximate addition time. - cl_timestamp timestamp NOT NULL, - - UNIQUE KEY cl_from (cl_from,cl_to), - - -- We always sort within a given category... - KEY cl_sortkey (cl_to,cl_sortkey), - - -- Not really used? - KEY cl_timestamp (cl_to,cl_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Track links to external URLs --- -CREATE TABLE /*$wgDBprefix*/externallinks ( - -- page_id of the referring page - el_from int(8) unsigned NOT NULL default '0', - - -- The URL - el_to blob NOT NULL, - - -- In the case of HTTP URLs, this is the URL with any username or password - -- removed, and with the labels in the hostname reversed and converted to - -- lower case. An extra dot is added to allow for matching of either - -- example.com or *.example.com in a single scan. - -- Example: - -- http://user:password@sub.example.com/page.html - -- becomes - -- http://com.example.sub./page.html - -- which allows for fast searching for all pages under example.com with the - -- clause: - -- WHERE el_index LIKE 'http://com.example.%' - el_index blob NOT NULL, - - KEY (el_from, el_to(40)), - KEY (el_to(60), el_from), - KEY (el_index(60)) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Track interlanguage links --- -CREATE TABLE /*$wgDBprefix*/langlinks ( - -- page_id of the referring page - ll_from int(8) unsigned NOT NULL default '0', - - -- Language code of the target - ll_lang varchar(10) binary NOT NULL default '', - - -- Title of the target, including namespace - ll_title varchar(255) binary NOT NULL default '', - - UNIQUE KEY (ll_from, ll_lang), - KEY (ll_lang, ll_title) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Contains a single row with some aggregate info --- on the state of the site. --- -CREATE TABLE /*$wgDBprefix*/site_stats ( - -- The single row should contain 1 here. - ss_row_id int(8) unsigned NOT NULL, - - -- Total number of page views, if hit counters are enabled. - ss_total_views bigint(20) unsigned default '0', - - -- Total number of edits performed. - ss_total_edits bigint(20) unsigned default '0', - - -- An approximate count of pages matching the following criteria: - -- * in namespace 0 - -- * not a redirect - -- * contains the text '[[' - -- See Article::isCountable() in includes/Article.php - ss_good_articles bigint(20) unsigned default '0', - - -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster - ss_total_pages bigint(20) default '-1', - - -- Number of users, theoretically equal to SELECT COUNT(*) FROM user; - ss_users bigint(20) default '-1', - - -- Deprecated, no longer updated as of 1.5 - ss_admins int(10) default '-1', - - -- Number of images, equivalent to SELECT COUNT(*) FROM image - ss_images int(10) default '0', - - UNIQUE KEY ss_row_id (ss_row_id) - -) ENGINE=InnoDB; - --- --- Stores an ID for every time any article is visited; --- depending on $wgHitcounterUpdateFreq, it is --- periodically cleared and the page_counter column --- in the page table updated for the all articles --- that have been visited.) --- -CREATE TABLE /*$wgDBprefix*/hitcounter ( - hc_id int unsigned NOT NULL -) ENGINE=HEAP MAX_ROWS=25000; - - --- --- The internet is full of jerks, alas. Sometimes it's handy --- to block a vandal or troll account. --- -CREATE TABLE /*$wgDBprefix*/ipblocks ( - -- Primary key, introduced for privacy. - ipb_id int(8) NOT NULL auto_increment, - - -- Blocked IP address in dotted-quad form or user name. - ipb_address tinyblob NOT NULL, - - -- Blocked user ID or 0 for IP blocks. - ipb_user int(8) unsigned NOT NULL default '0', - - -- User ID who made the block. - ipb_by int(8) unsigned NOT NULL default '0', - - -- Text comment made by blocker. - ipb_reason tinyblob NOT NULL, - - -- Creation (or refresh) date in standard YMDHMS form. - -- IP blocks expire automatically. - ipb_timestamp char(14) binary NOT NULL default '', - - -- Indicates that the IP address was banned because a banned - -- user accessed a page through it. If this is 1, ipb_address - -- will be hidden, and the block identified by block ID number. - ipb_auto bool NOT NULL default '0', - - -- If set to 1, block applies only to logged-out users - ipb_anon_only bool NOT NULL default 0, - - -- Block prevents account creation from matching IP addresses - ipb_create_account bool NOT NULL default 1, - - -- Block triggers autoblocks - ipb_enable_autoblock bool NOT NULL default '1', - - -- Time at which the block will expire. - ipb_expiry char(14) binary NOT NULL default '', - - -- Start and end of an address range, in hexadecimal - -- Size chosen to allow IPv6 - ipb_range_start varchar(32) NOT NULL default '', - ipb_range_end varchar(32) NOT NULL default '', - - PRIMARY KEY ipb_id (ipb_id), - - -- Unique index to support "user already blocked" messages - -- Any new options which prevent collisions should be included - UNIQUE INDEX ipb_address (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only), - - INDEX ipb_user (ipb_user), - INDEX ipb_range (ipb_range_start(8), ipb_range_end(8)), - INDEX ipb_timestamp (ipb_timestamp), - INDEX ipb_expiry (ipb_expiry) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Uploaded images and other files. --- -CREATE TABLE /*$wgDBprefix*/image ( - -- Filename. - -- This is also the title of the associated description page, - -- which will be in namespace 6 (NS_IMAGE). - img_name varchar(255) binary NOT NULL default '', - - -- File size in bytes. - img_size int(8) unsigned NOT NULL default '0', - - -- For images, size in pixels. - img_width int(5) NOT NULL default '0', - img_height int(5) NOT NULL default '0', - - -- Extracted EXIF metadata stored as a serialized PHP array. - img_metadata mediumblob NOT NULL, - - -- For images, bits per pixel if known. - img_bits int(3) NOT NULL default '0', - - -- Media type as defined by the MEDIATYPE_xxx constants - img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - - -- major part of a MIME media type as defined by IANA - -- see http://www.iana.org/assignments/media-types/ - img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown", - - -- minor part of a MIME media type as defined by IANA - -- the minor parts are not required to adher to any standard - -- but should be consistent throughout the database - -- see http://www.iana.org/assignments/media-types/ - img_minor_mime varchar(32) NOT NULL default "unknown", - - -- Description field as entered by the uploader. - -- This is displayed in image upload history and logs. - img_description tinyblob NOT NULL, - - -- user_id and user_name of uploader. - img_user int(5) unsigned NOT NULL default '0', - img_user_text varchar(255) binary NOT NULL default '', - - -- Time of the upload. - img_timestamp char(14) binary NOT NULL default '', - - PRIMARY KEY img_name (img_name), - - -- Used by Special:Imagelist for sort-by-size - INDEX img_size (img_size), - - -- Used by Special:Newimages and Special:Imagelist - INDEX img_timestamp (img_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Previous revisions of uploaded files. --- Awkwardly, image rows have to be moved into --- this table at re-upload time. --- -CREATE TABLE /*$wgDBprefix*/oldimage ( - -- Base filename: key to image.img_name - oi_name varchar(255) binary NOT NULL default '', - - -- Filename of the archived file. - -- This is generally a timestamp and '!' prepended to the base name. - oi_archive_name varchar(255) binary NOT NULL default '', - - -- Other fields as in image... - oi_size int(8) unsigned NOT NULL default 0, - oi_width int(5) NOT NULL default 0, - oi_height int(5) NOT NULL default 0, - oi_bits int(3) NOT NULL default 0, - oi_description tinyblob NOT NULL, - oi_user int(5) unsigned NOT NULL default '0', - oi_user_text varchar(255) binary NOT NULL default '', - oi_timestamp char(14) binary NOT NULL default '', - - INDEX oi_name (oi_name(10)) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Record of deleted file data --- -CREATE TABLE /*$wgDBprefix*/filearchive ( - -- Unique row id - fa_id int NOT NULL auto_increment, - - -- Original base filename; key to image.img_name, page.page_title, etc - fa_name varchar(255) binary NOT NULL default '', - - -- Filename of archived file, if an old revision - fa_archive_name varchar(255) binary default '', - - -- Which storage bin (directory tree or object store) the file data - -- is stored in. Should be 'deleted' for files that have been deleted; - -- any other bin is not yet in use. - fa_storage_group varchar(16), - - -- SHA-1 of the file contents plus extension, used as a key for storage. - -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg - -- - -- If NULL, the file was missing at deletion time or has been purged - -- from the archival storage. - fa_storage_key varchar(64) binary default '', - - -- Deletion information, if this file is deleted. - fa_deleted_user int, - fa_deleted_timestamp char(14) binary default '', - fa_deleted_reason text, - - -- Duped fields from image - fa_size int(8) unsigned default '0', - fa_width int(5) default '0', - fa_height int(5) default '0', - fa_metadata mediumblob, - fa_bits int(3) default '0', - fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") default "unknown", - fa_minor_mime varchar(32) default "unknown", - fa_description tinyblob, - fa_user int(5) unsigned default '0', - fa_user_text varchar(255) binary default '', - fa_timestamp char(14) binary default '', - - PRIMARY KEY (fa_id), - INDEX (fa_name, fa_timestamp), -- pick out by image name - INDEX (fa_storage_group, fa_storage_key), -- pick out dupe files - INDEX (fa_deleted_timestamp), -- sort by deletion time - INDEX (fa_deleted_user) -- sort by deleter - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Primarily a summary table for Special:Recentchanges, --- this table contains some additional info on edits from --- the last few days, see Article::editUpdates() --- -CREATE TABLE /*$wgDBprefix*/recentchanges ( - rc_id int(8) NOT NULL auto_increment, - rc_timestamp varchar(14) binary NOT NULL default '', - rc_cur_time varchar(14) binary NOT NULL default '', - - -- As in revision - rc_user int(10) unsigned NOT NULL default '0', - rc_user_text varchar(255) binary NOT NULL default '', - - -- When pages are renamed, their RC entries do _not_ change. - rc_namespace int NOT NULL default '0', - rc_title varchar(255) binary NOT NULL default '', - - -- as in revision... - rc_comment varchar(255) binary NOT NULL default '', - rc_minor tinyint(3) unsigned NOT NULL default '0', - - -- Edits by user accounts with the 'bot' rights key are - -- marked with a 1 here, and will be hidden from the - -- default view. - rc_bot tinyint(3) unsigned NOT NULL default '0', - - rc_new tinyint(3) unsigned NOT NULL default '0', - - -- Key to page_id (was cur_id prior to 1.5). - -- This will keep links working after moves while - -- retaining the at-the-time name in the changes list. - rc_cur_id int(10) unsigned NOT NULL default '0', - - -- rev_id of the given revision - rc_this_oldid int(10) unsigned NOT NULL default '0', - - -- rev_id of the prior revision, for generating diff links. - rc_last_oldid int(10) unsigned NOT NULL default '0', - - -- These may no longer be used, with the new move log. - rc_type tinyint(3) unsigned NOT NULL default '0', - rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0', - rc_moved_to_title varchar(255) binary NOT NULL default '', - - -- If the Recent Changes Patrol option is enabled, - -- users may mark edits as having been reviewed to - -- remove a warning flag on the RC list. - -- A value of 1 indicates the page has been reviewed. - rc_patrolled tinyint(3) unsigned NOT NULL default '0', - - -- Recorded IP address the edit was made from, if the - -- $wgPutIPinRC option is enabled. - rc_ip char(15) NOT NULL default '', - - -- Text length in characters before - -- and after the edit - rc_old_len int(10) default '0', - rc_new_len int(10) default '0', - - PRIMARY KEY rc_id (rc_id), - INDEX rc_timestamp (rc_timestamp), - INDEX rc_namespace_title (rc_namespace, rc_title), - INDEX rc_cur_id (rc_cur_id), - INDEX new_name_timestamp (rc_new,rc_namespace,rc_timestamp), - INDEX rc_ip (rc_ip), - INDEX rc_ns_usertext ( rc_namespace, rc_user_text ) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - -CREATE TABLE /*$wgDBprefix*/watchlist ( - -- Key to user.user_id - wl_user int(5) unsigned NOT NULL, - - -- Key to page_namespace/page_title - -- Note that users may watch pages which do not exist yet, - -- or existed in the past but have been deleted. - wl_namespace int NOT NULL default '0', - wl_title varchar(255) binary NOT NULL default '', - - -- Timestamp when user was last sent a notification e-mail; - -- cleared when the user visits the page. - wl_notificationtimestamp varchar(14) binary, - - UNIQUE KEY (wl_user, wl_namespace, wl_title), - KEY namespace_title (wl_namespace,wl_title) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - - --- --- Used by the math module to keep track --- of previously-rendered items. --- -CREATE TABLE /*$wgDBprefix*/math ( - -- Binary MD5 hash of the latex fragment, used as an identifier key. - math_inputhash varbinary(16) NOT NULL, - - -- Not sure what this is, exactly... - math_outputhash varbinary(16) NOT NULL, - - -- texvc reports how well it thinks the HTML conversion worked; - -- if it's a low level the PNG rendering may be preferred. - math_html_conservativeness tinyint(1) NOT NULL, - - -- HTML output from texvc, if any - math_html text, - - -- MathML output from texvc, if any - math_mathml text, - - UNIQUE KEY math_inputhash (math_inputhash) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- When using the default MySQL search backend, page titles --- and text are munged to strip markup, do Unicode case folding, --- and prepare the result for MySQL's fulltext index. --- --- This table must be MyISAM; InnoDB does not support the needed --- fulltext index. --- -CREATE TABLE /*$wgDBprefix*/searchindex ( - -- Key to page_id - si_page int(8) unsigned NOT NULL, - - -- Munged version of title - si_title varchar(255) NOT NULL default '', - - -- Munged version of body text - si_text mediumtext NOT NULL, - - UNIQUE KEY (si_page), - FULLTEXT si_title (si_title), - FULLTEXT si_text (si_text) - -) ENGINE=MyISAM, DEFAULT CHARSET=utf8; - --- --- Recognized interwiki link prefixes --- -CREATE TABLE /*$wgDBprefix*/interwiki ( - -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de") - iw_prefix char(32) NOT NULL, - - -- The URL of the wiki, with "$1" as a placeholder for an article name. - -- Any spaces in the name will be transformed to underscores before - -- insertion. - iw_url char(127) NOT NULL, - - -- A boolean value indicating whether the wiki is in this project - -- (used, for example, to detect redirect loops) - iw_local bool NOT NULL, - - -- Boolean value indicating whether interwiki transclusions are allowed. - iw_trans tinyint(1) NOT NULL default 0, - - UNIQUE KEY iw_prefix (iw_prefix) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Used for caching expensive grouped queries --- -CREATE TABLE /*$wgDBprefix*/querycache ( - -- A key name, generally the base name of of the special page. - qc_type char(32) NOT NULL, - - -- Some sort of stored value. Sizes, counts... - qc_value int(5) unsigned NOT NULL default '0', - - -- Target namespace+title - qc_namespace int NOT NULL default '0', - qc_title char(255) binary NOT NULL default '', - - KEY (qc_type,qc_value) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- For a few generic cache operations if not using Memcached --- -CREATE TABLE /*$wgDBprefix*/objectcache ( - keyname char(255) binary NOT NULL default '', - value mediumblob, - exptime datetime, - UNIQUE KEY (keyname), - KEY (exptime) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- --- Cache of interwiki transclusion --- -CREATE TABLE /*$wgDBprefix*/transcache ( - tc_url varchar(255) NOT NULL, - tc_contents text, - tc_time int NOT NULL, - UNIQUE INDEX tc_url_idx (tc_url) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - -CREATE TABLE /*$wgDBprefix*/logging ( - -- Symbolic keys for the general log type and the action type - -- within the log. The output format will be controlled by the - -- action field, but only the type controls categorization. - log_type char(10) NOT NULL default '', - log_action char(10) NOT NULL default '', - - -- Timestamp. Duh. - log_timestamp char(14) NOT NULL default '19700101000000', - - -- The user who performed this action; key to user_id - log_user int unsigned NOT NULL default 0, - - -- Key to the page affected. Where a user is the target, - -- this will point to the user page. - log_namespace int NOT NULL default 0, - log_title varchar(255) binary NOT NULL default '', - - -- Freeform text. Interpreted as edit history comments. - log_comment varchar(255) NOT NULL default '', - - -- LF separated list of miscellaneous parameters - log_params blob NOT NULL, - - KEY type_time (log_type, log_timestamp), - KEY user_time (log_user, log_timestamp), - KEY page_time (log_namespace, log_title, log_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - -CREATE TABLE /*$wgDBprefix*/trackbacks ( - tb_id int auto_increment, - tb_page int REFERENCES page(page_id) ON DELETE CASCADE, - tb_title varchar(255) NOT NULL, - tb_url varchar(255) NOT NULL, - tb_ex text, - tb_name varchar(255), - - PRIMARY KEY (tb_id), - INDEX (tb_page) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- Jobs performed by parallel apache threads or a command-line daemon -CREATE TABLE /*$wgDBprefix*/job ( - job_id int(9) unsigned NOT NULL auto_increment, - - -- Command name, currently only refreshLinks is defined - job_cmd varchar(255) NOT NULL default '', - - -- Namespace and title to act on - -- Should be 0 and '' if the command does not operate on a title - job_namespace int NOT NULL, - job_title varchar(255) binary NOT NULL, - - -- Any other parameters to the command - -- Presently unused, format undefined - job_params blob NOT NULL, - - PRIMARY KEY job_id (job_id), - KEY (job_cmd, job_namespace, job_title) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- Details of updates to cached special pages -CREATE TABLE /*$wgDBprefix*/querycache_info ( - - -- Special page name - -- Corresponds to a qc_type value - qci_type varchar(32) NOT NULL default '', - - -- Timestamp of last update - qci_timestamp char(14) NOT NULL default '19700101000000', - - UNIQUE KEY ( qci_type ) - -) ENGINE=InnoDB; - --- For each redirect, this table contains exactly one row defining its target -CREATE TABLE /*$wgDBprefix*/redirect ( - -- Key to the page_id of the redirect page - rd_from int(8) unsigned NOT NULL default '0', - - -- Key to page_namespace/page_title of the target page. - -- The target page may or may not exist, and due to renames - -- and deletions may refer to different page records as time - -- goes by. - rd_namespace int NOT NULL default '0', - rd_title varchar(255) binary NOT NULL default '', - - PRIMARY KEY rd_from (rd_from), - KEY rd_ns_title (rd_namespace,rd_title,rd_from) -) ENGINE=InnoDB, DEFAULT CHARSET=binary; - --- Used for caching expensive grouped queries that need two links (for example double-redirects) - -CREATE TABLE /*$wgDBprefix*/querycachetwo ( - -- A key name, generally the base name of of the special page. - qcc_type char(32) NOT NULL, - - -- Some sort of stored value. Sizes, counts... - qcc_value int(5) unsigned NOT NULL default '0', - - -- Target namespace+title - qcc_namespace int NOT NULL default '0', - qcc_title char(255) binary NOT NULL default '', - - -- Target namespace+title2 - qcc_namespacetwo int NOT NULL default '0', - qcc_titletwo char(255) binary NOT NULL default '', - - KEY qcc_type (qcc_type,qcc_value), - KEY qcc_title (qcc_type,qcc_namespace,qcc_title), - KEY qcc_titletwo (qcc_type,qcc_namespacetwo,qcc_titletwo) - -) ENGINE=InnoDB, DEFAULT CHARSET=binary; diff --git a/maintenance/mysql5/tables.sql b/maintenance/mysql5/tables.sql deleted file mode 100644 index 356f3bbf..00000000 --- a/maintenance/mysql5/tables.sql +++ /dev/null @@ -1,1086 +0,0 @@ --- Experimental table definitions for MySQL 4.1 and 5.0 with --- explicit character set support. Not fully tested, may have --- surprises! --- --- TODO: Test various fields --- TODO: Anything else need to be moved to VARBINARY and BLOB? --- TODO: UCS-2 better than UTF-8? --- TODO: Find out how to get 4-byte UTF-8 chars into MySQL... --- An alternate UCS-2 that does UTF-16 conversion would work. --- TODO: Work on collation usage - --- ------------------------------------------------------------ - --- SQL to create the initial tables for the MediaWiki database. --- This is read and executed by the install script; you should --- not have to run it by itself unless doing a manual install. - --- --- General notes: --- --- If possible, create tables as InnoDB to benefit from the --- superior resiliency against crashes and ability to read --- during writes (and write during reads!) --- --- Only the 'searchindex' table requires MyISAM due to the --- requirement for fulltext index support, which is missing --- from InnoDB. --- --- --- The MySQL table backend for MediaWiki currently uses --- 14-character CHAR or VARCHAR fields to store timestamps. --- The format is YYYYMMDDHHMMSS, which is derived from the --- text format of MySQL's TIMESTAMP fields. --- --- Historically TIMESTAMP fields were used, but abandoned --- in early 2002 after a lot of trouble with the fields --- auto-updating. --- --- The Postgres backend uses DATETIME fields for timestamps, --- and we will migrate the MySQL definitions at some point as --- well. --- --- --- The /*$wgDBprefix*/ comments in this and other files are --- replaced with the defined table prefix by the installer --- and updater scripts. If you are installing or running --- updates manually, you will need to manually insert the --- table prefix if any when running these scripts. --- - - --- --- The user table contains basic account information, --- authentication keys, etc. --- --- Some multi-wiki sites may share a single central user table --- between separate wikis using the $wgSharedDB setting. --- --- Note that when a external authentication plugin is used, --- user table entries still need to be created to store --- preferences and to key tracking information in the other --- tables. --- -CREATE TABLE /*$wgDBprefix*/user ( - user_id int(5) unsigned NOT NULL auto_increment, - - -- Usernames must be unique, must not be in the form of - -- an IP address. _Shouldn't_ allow slashes or case - -- conflicts. Spaces are allowed, and are _not_ converted - -- to underscores like titles. See the User::newFromName() for - -- the specific tests that usernames have to pass. - user_name varchar(255) binary NOT NULL default '', - - -- Optional 'real name' to be displayed in credit listings - user_real_name varchar(255) binary NOT NULL default '', - - -- Password hashes, normally hashed like so: - -- MD5(CONCAT(user_id,'-',MD5(plaintext_password))), see - -- wfEncryptPassword() in GlobalFunctions.php - user_password tinyblob NOT NULL, - - -- When using 'mail me a new password', a random - -- password is generated and the hash stored here. - -- The previous password is left in place until - -- someone actually logs in with the new password, - -- at which point the hash is moved to user_password - -- and the old password is invalidated. - user_newpassword tinyblob NOT NULL, - - -- Timestamp of the last time when a new password was - -- sent, for throttling purposes - user_newpass_time char(14) binary, - - -- Note: email should be restricted, not public info. - -- Same with passwords. - user_email tinytext NOT NULL, - - -- Newline-separated list of name=value defining the user - -- preferences - user_options blob NOT NULL, - - -- This is a timestamp which is updated when a user - -- logs in, logs out, changes preferences, or performs - -- some other action requiring HTML cache invalidation - -- to ensure that the UI is updated. - user_touched char(14) binary NOT NULL default '', - - -- A pseudorandomly generated value that is stored in - -- a cookie when the "remember password" feature is - -- used (previously, a hash of the password was used, but - -- this was vulnerable to cookie-stealing attacks) - user_token char(32) binary NOT NULL default '', - - -- Initially NULL; when a user's e-mail address has been - -- validated by returning with a mailed token, this is - -- set to the current timestamp. - user_email_authenticated char(14) binary, - - -- Randomly generated token created when the e-mail address - -- is set and a confirmation test mail sent. - user_email_token char(32) binary, - - -- Expiration date for the user_email_token - user_email_token_expires char(14) binary, - - -- Timestamp of account registration. - -- Accounts predating this schema addition may contain NULL. - user_registration char(14) binary, - - -- Count of edits and edit-like actions. - -- - -- *NOT* intended to be an accurate copy of COUNT(*) WHERE rev_user=user_id - -- May contain NULL for old accounts if batch-update scripts haven't been - -- run, as well as listing deleted edits and other myriad ways it could be - -- out of sync. - -- - -- Meant primarily for heuristic checks to give an impression of whether - -- the account has been used much. - -- - user_editcount int, - - PRIMARY KEY user_id (user_id), - UNIQUE INDEX user_name (user_name), - INDEX (user_email_token) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- User permissions have been broken out to a separate table; --- this allows sites with a shared user table to have different --- permissions assigned to a user in each project. --- --- This table replaces the old user_rights field which used a --- comma-separated blob. --- -CREATE TABLE /*$wgDBprefix*/user_groups ( - -- Key to user_id - ug_user int(5) unsigned NOT NULL default '0', - - -- Group names are short symbolic string keys. - -- The set of group names is open-ended, though in practice - -- only some predefined ones are likely to be used. - -- - -- At runtime $wgGroupPermissions will associate group keys - -- with particular permissions. A user will have the combined - -- permissions of any group they're explicitly in, plus - -- the implicit '*' and 'user' groups. - ug_group char(16) NOT NULL default '', - - PRIMARY KEY (ug_user,ug_group), - KEY (ug_group) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- Stores notifications of user talk page changes, for the display --- of the "you have new messages" box -CREATE TABLE /*$wgDBprefix*/user_newtalk ( - -- Key to user.user_id - user_id int(5) NOT NULL default '0', - -- If the user is an anonymous user hir IP address is stored here - -- since the user_id of 0 is ambiguous - user_ip varchar(40) NOT NULL default '', - INDEX user_id (user_id), - INDEX user_ip (user_ip) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Core of the wiki: each page has an entry here which identifies --- it by title and contains some essential metadata. --- -CREATE TABLE /*$wgDBprefix*/page ( - -- Unique identifier number. The page_id will be preserved across - -- edits and rename operations, but not deletions and recreations. - page_id int(8) unsigned NOT NULL auto_increment, - - -- A page name is broken into a namespace and a title. - -- The namespace keys are UI-language-independent constants, - -- defined in includes/Defines.php - page_namespace int NOT NULL, - - -- The rest of the title, as text. - -- Spaces are transformed into underscores in title storage. - page_title varchar(255) binary NOT NULL, - - -- Comma-separated set of permission keys indicating who - -- can move or edit the page. - page_restrictions tinyblob NOT NULL, - - -- Number of times this page has been viewed. - page_counter bigint(20) unsigned NOT NULL default '0', - - -- 1 indicates the article is a redirect. - page_is_redirect tinyint(1) unsigned NOT NULL default '0', - - -- 1 indicates this is a new entry, with only one edit. - -- Not all pages with one edit are new pages. - page_is_new tinyint(1) unsigned NOT NULL default '0', - - -- Random value between 0 and 1, used for Special:Randompage - page_random real unsigned NOT NULL, - - -- This timestamp is updated whenever the page changes in - -- a way requiring it to be re-rendered, invalidating caches. - -- Aside from editing this includes permission changes, - -- creation or deletion of linked pages, and alteration - -- of contained templates. - page_touched char(14) binary NOT NULL default '', - - -- Handy key to revision.rev_id of the current revision. - -- This may be 0 during page creation, but that shouldn't - -- happen outside of a transaction... hopefully. - page_latest int(8) unsigned NOT NULL, - - -- Uncompressed length in bytes of the page's current source text. - page_len int(8) unsigned NOT NULL, - - PRIMARY KEY page_id (page_id), - UNIQUE INDEX name_title (page_namespace,page_title), - - -- Special-purpose indexes - INDEX (page_random), - INDEX (page_len) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Every edit of a page creates also a revision row. --- This stores metadata about the revision, and a reference --- to the text storage backend. --- -CREATE TABLE /*$wgDBprefix*/revision ( - rev_id int(8) unsigned NOT NULL auto_increment, - - -- Key to page_id. This should _never_ be invalid. - rev_page int(8) unsigned NOT NULL, - - -- Key to text.old_id, where the actual bulk text is stored. - -- It's possible for multiple revisions to use the same text, - -- for instance revisions where only metadata is altered - -- or a rollback to a previous version. - rev_text_id int(8) unsigned NOT NULL, - - -- Text comment summarizing the change. - -- This text is shown in the history and other changes lists, - -- rendered in a subset of wiki markup by Linker::formatComment() - rev_comment tinyblob NOT NULL, - - -- Key to user.user_id of the user who made this edit. - -- Stores 0 for anonymous edits and for some mass imports. - rev_user int(5) unsigned NOT NULL default '0', - - -- Text username or IP address of the editor. - rev_user_text varchar(255) binary NOT NULL default '', - - -- Timestamp - rev_timestamp char(14) binary NOT NULL default '', - - -- Records whether the user marked the 'minor edit' checkbox. - -- Many automated edits are marked as minor. - rev_minor_edit tinyint(1) unsigned NOT NULL default '0', - - -- Not yet used; reserved for future changes to the deletion system. - rev_deleted tinyint(1) unsigned NOT NULL default '0', - - PRIMARY KEY rev_page_id (rev_page, rev_id), - UNIQUE INDEX rev_id (rev_id), - INDEX rev_timestamp (rev_timestamp), - INDEX page_timestamp (rev_page,rev_timestamp), - INDEX user_timestamp (rev_user,rev_timestamp), - INDEX usertext_timestamp (rev_user_text,rev_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Holds text of individual page revisions. --- --- Field names are a holdover from the 'old' revisions table in --- MediaWiki 1.4 and earlier: an upgrade will transform that --- table into the 'text' table to minimize unnecessary churning --- and downtime. If upgrading, the other fields will be left unused. --- -CREATE TABLE /*$wgDBprefix*/text ( - -- Unique text storage key number. - -- Note that the 'oldid' parameter used in URLs does *not* - -- refer to this number anymore, but to rev_id. - -- - -- revision.rev_text_id is a key to this column - old_id int(8) unsigned NOT NULL auto_increment, - - -- Depending on the contents of the old_flags field, the text - -- may be convenient plain text, or it may be funkily encoded. - old_text mediumblob NOT NULL, - - -- Comma-separated list of flags: - -- gzip: text is compressed with PHP's gzdeflate() function. - -- utf8: text was stored as UTF-8. - -- If $wgLegacyEncoding option is on, rows *without* this flag - -- will be converted to UTF-8 transparently at load time. - -- object: text field contained a serialized PHP object. - -- The object either contains multiple versions compressed - -- together to achieve a better compression ratio, or it refers - -- to another row where the text can be found. - old_flags tinyblob NOT NULL, - - PRIMARY KEY old_id (old_id) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Holding area for deleted articles, which may be viewed --- or restored by admins through the Special:Undelete interface. --- The fields generally correspond to the page, revision, and text --- fields, with several caveats. --- -CREATE TABLE /*$wgDBprefix*/archive ( - ar_namespace int NOT NULL default '0', - ar_title varchar(255) binary NOT NULL default '', - - -- Newly deleted pages will not store text in this table, - -- but will reference the separately existing text rows. - -- This field is retained for backwards compatibility, - -- so old archived pages will remain accessible after - -- upgrading from 1.4 to 1.5. - -- Text may be gzipped or otherwise funky. - ar_text mediumblob NOT NULL, - - -- Basic revision stuff... - ar_comment tinyblob NOT NULL, - ar_user int(5) unsigned NOT NULL default '0', - ar_user_text varchar(255) binary NOT NULL, - ar_timestamp char(14) binary NOT NULL default '', - ar_minor_edit tinyint(1) NOT NULL default '0', - - -- See ar_text note. - ar_flags tinyblob NOT NULL, - - -- When revisions are deleted, their unique rev_id is stored - -- here so it can be retained after undeletion. This is necessary - -- to retain permalinks to given revisions after accidental delete - -- cycles or messy operations like history merges. - -- - -- Old entries from 1.4 will be NULL here, and a new rev_id will - -- be created on undeletion for those revisions. - ar_rev_id int(8) unsigned, - - -- For newly deleted revisions, this is the text.old_id key to the - -- actual stored text. To avoid breaking the block-compression scheme - -- and otherwise making storage changes harder, the actual text is - -- *not* deleted from the text table, merely hidden by removal of the - -- page and revision entries. - -- - -- Old entries deleted under 1.2-1.4 will have NULL here, and their - -- ar_text and ar_flags fields will be used to create a new text - -- row upon undeletion. - ar_text_id int(8) unsigned, - - KEY name_title_timestamp (ar_namespace,ar_title,ar_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Track page-to-page hyperlinks within the wiki. --- -CREATE TABLE /*$wgDBprefix*/pagelinks ( - -- Key to the page_id of the page containing the link. - pl_from int(8) unsigned NOT NULL default '0', - - -- Key to page_namespace/page_title of the target page. - -- The target page may or may not exist, and due to renames - -- and deletions may refer to different page records as time - -- goes by. - pl_namespace int NOT NULL default '0', - pl_title varchar(255) binary NOT NULL default '', - - UNIQUE KEY pl_from (pl_from,pl_namespace,pl_title), - KEY (pl_namespace,pl_title,pl_from) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Track template inclusions. --- -CREATE TABLE /*$wgDBprefix*/templatelinks ( - -- Key to the page_id of the page containing the link. - tl_from int(8) unsigned NOT NULL default '0', - - -- Key to page_namespace/page_title of the target page. - -- The target page may or may not exist, and due to renames - -- and deletions may refer to different page records as time - -- goes by. - tl_namespace int NOT NULL default '0', - tl_title varchar(255) binary NOT NULL default '', - - UNIQUE KEY tl_from (tl_from,tl_namespace,tl_title), - KEY (tl_namespace,tl_title,tl_from) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Track links to images *used inline* --- We don't distinguish live from broken links here, so --- they do not need to be changed on upload/removal. --- -CREATE TABLE /*$wgDBprefix*/imagelinks ( - -- Key to page_id of the page containing the image / media link. - il_from int(8) unsigned NOT NULL default '0', - - -- Filename of target image. - -- This is also the page_title of the file's description page; - -- all such pages are in namespace 6 (NS_IMAGE). - il_to varchar(255) binary NOT NULL default '', - - UNIQUE KEY il_from (il_from,il_to), - KEY (il_to,il_from) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Track category inclusions *used inline* --- This tracks a single level of category membership --- (folksonomic tagging, really). --- -CREATE TABLE /*$wgDBprefix*/categorylinks ( - -- Key to page_id of the page defined as a category member. - cl_from int(8) unsigned NOT NULL default '0', - - -- Name of the category. - -- This is also the page_title of the category's description page; - -- all such pages are in namespace 14 (NS_CATEGORY). - cl_to varchar(255) binary NOT NULL default '', - - -- The title of the linking page, or an optional override - -- to determine sort order. Sorting is by binary order, which - -- isn't always ideal, but collations seem to be an exciting - -- and dangerous new world in MySQL... - -- - -- For MySQL 4.1+ with charset set to utf8, the sort key *index* - -- needs cut to be smaller than 1024 bytes (at 3 bytes per char). - -- To sort properly on the shorter key, this field needs to be - -- the same shortness. - cl_sortkey varchar(86) binary NOT NULL default '', - - -- This isn't really used at present. Provided for an optional - -- sorting method by approximate addition time. - cl_timestamp timestamp NOT NULL, - - UNIQUE KEY cl_from (cl_from,cl_to), - - -- We always sort within a given category... - KEY cl_sortkey (cl_to,cl_sortkey), - - -- Not really used? - KEY cl_timestamp (cl_to,cl_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Track links to external URLs --- -CREATE TABLE /*$wgDBprefix*/externallinks ( - -- page_id of the referring page - el_from int(8) unsigned NOT NULL default '0', - - -- The URL - el_to blob NOT NULL, - - -- In the case of HTTP URLs, this is the URL with any username or password - -- removed, and with the labels in the hostname reversed and converted to - -- lower case. An extra dot is added to allow for matching of either - -- example.com or *.example.com in a single scan. - -- Example: - -- http://user:password@sub.example.com/page.html - -- becomes - -- http://com.example.sub./page.html - -- which allows for fast searching for all pages under example.com with the - -- clause: - -- WHERE el_index LIKE 'http://com.example.%' - el_index blob NOT NULL, - - KEY (el_from, el_to(40)), - KEY (el_to(60), el_from), - KEY (el_index(60)) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Track interlanguage links --- -CREATE TABLE /*$wgDBprefix*/langlinks ( - -- page_id of the referring page - ll_from int(8) unsigned NOT NULL default '0', - - -- Language code of the target - ll_lang varchar(10) binary NOT NULL default '', - - -- Title of the target, including namespace - ll_title varchar(255) binary NOT NULL default '', - - UNIQUE KEY (ll_from, ll_lang), - KEY (ll_lang, ll_title) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Contains a single row with some aggregate info --- on the state of the site. --- -CREATE TABLE /*$wgDBprefix*/site_stats ( - -- The single row should contain 1 here. - ss_row_id int(8) unsigned NOT NULL, - - -- Total number of page views, if hit counters are enabled. - ss_total_views bigint(20) unsigned default '0', - - -- Total number of edits performed. - ss_total_edits bigint(20) unsigned default '0', - - -- An approximate count of pages matching the following criteria: - -- * in namespace 0 - -- * not a redirect - -- * contains the text '[[' - -- See Article::isCountable() in includes/Article.php - ss_good_articles bigint(20) unsigned default '0', - - -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster - ss_total_pages bigint(20) default '-1', - - -- Number of users, theoretically equal to SELECT COUNT(*) FROM user; - ss_users bigint(20) default '-1', - - -- Deprecated, no longer updated as of 1.5 - ss_admins int(10) default '-1', - - -- Number of images, equivalent to SELECT COUNT(*) FROM image - ss_images int(10) default '0', - - UNIQUE KEY ss_row_id (ss_row_id) - -) ENGINE=InnoDB; - --- --- Stores an ID for every time any article is visited; --- depending on $wgHitcounterUpdateFreq, it is --- periodically cleared and the page_counter column --- in the page table updated for the all articles --- that have been visited.) --- -CREATE TABLE /*$wgDBprefix*/hitcounter ( - hc_id int unsigned NOT NULL -) ENGINE=HEAP MAX_ROWS=25000; - - --- --- The internet is full of jerks, alas. Sometimes it's handy --- to block a vandal or troll account. --- -CREATE TABLE /*$wgDBprefix*/ipblocks ( - -- Primary key, introduced for privacy. - ipb_id int(8) NOT NULL auto_increment, - - -- Blocked IP address in dotted-quad form or user name. - ipb_address tinyblob NOT NULL, - - -- Blocked user ID or 0 for IP blocks. - ipb_user int(8) unsigned NOT NULL default '0', - - -- User ID who made the block. - ipb_by int(8) unsigned NOT NULL default '0', - - -- Text comment made by blocker. - ipb_reason tinyblob NOT NULL, - - -- Creation (or refresh) date in standard YMDHMS form. - -- IP blocks expire automatically. - ipb_timestamp char(14) binary NOT NULL default '', - - -- Indicates that the IP address was banned because a banned - -- user accessed a page through it. If this is 1, ipb_address - -- will be hidden, and the block identified by block ID number. - ipb_auto bool NOT NULL default '0', - - -- If set to 1, block applies only to logged-out users - ipb_anon_only bool NOT NULL default 0, - - -- Block prevents account creation from matching IP addresses - ipb_create_account bool NOT NULL default 1, - - -- Block triggers autoblocks - ipb_enable_autoblock bool NOT NULL default '1', - - -- Time at which the block will expire. - ipb_expiry char(14) binary NOT NULL default '', - - -- Start and end of an address range, in hexadecimal - -- Size chosen to allow IPv6 - ipb_range_start varchar(32) NOT NULL default '', - ipb_range_end varchar(32) NOT NULL default '', - - PRIMARY KEY ipb_id (ipb_id), - - -- Unique index to support "user already blocked" messages - -- Any new options which prevent collisions should be included - UNIQUE INDEX ipb_address (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only), - - INDEX ipb_user (ipb_user), - INDEX ipb_range (ipb_range_start(8), ipb_range_end(8)), - INDEX ipb_timestamp (ipb_timestamp), - INDEX ipb_expiry (ipb_expiry) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Uploaded images and other files. --- -CREATE TABLE /*$wgDBprefix*/image ( - -- Filename. - -- This is also the title of the associated description page, - -- which will be in namespace 6 (NS_IMAGE). - img_name varchar(255) binary NOT NULL default '', - - -- File size in bytes. - img_size int(8) unsigned NOT NULL default '0', - - -- For images, size in pixels. - img_width int(5) NOT NULL default '0', - img_height int(5) NOT NULL default '0', - - -- Extracted EXIF metadata stored as a serialized PHP array. - img_metadata mediumblob NOT NULL, - - -- For images, bits per pixel if known. - img_bits int(3) NOT NULL default '0', - - -- Media type as defined by the MEDIATYPE_xxx constants - img_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - - -- major part of a MIME media type as defined by IANA - -- see http://www.iana.org/assignments/media-types/ - img_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") NOT NULL default "unknown", - - -- minor part of a MIME media type as defined by IANA - -- the minor parts are not required to adher to any standard - -- but should be consistent throughout the database - -- see http://www.iana.org/assignments/media-types/ - img_minor_mime varchar(32) NOT NULL default "unknown", - - -- Description field as entered by the uploader. - -- This is displayed in image upload history and logs. - img_description tinyblob NOT NULL, - - -- user_id and user_name of uploader. - img_user int(5) unsigned NOT NULL default '0', - img_user_text varchar(255) binary NOT NULL default '', - - -- Time of the upload. - img_timestamp char(14) binary NOT NULL default '', - - PRIMARY KEY img_name (img_name), - - -- Used by Special:Imagelist for sort-by-size - INDEX img_size (img_size), - - -- Used by Special:Newimages and Special:Imagelist - INDEX img_timestamp (img_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Previous revisions of uploaded files. --- Awkwardly, image rows have to be moved into --- this table at re-upload time. --- -CREATE TABLE /*$wgDBprefix*/oldimage ( - -- Base filename: key to image.img_name - oi_name varchar(255) binary NOT NULL default '', - - -- Filename of the archived file. - -- This is generally a timestamp and '!' prepended to the base name. - oi_archive_name varchar(255) binary NOT NULL default '', - - -- Other fields as in image... - oi_size int(8) unsigned NOT NULL default 0, - oi_width int(5) NOT NULL default 0, - oi_height int(5) NOT NULL default 0, - oi_bits int(3) NOT NULL default 0, - oi_description tinyblob NOT NULL, - oi_user int(5) unsigned NOT NULL default '0', - oi_user_text varchar(255) binary NOT NULL default '', - oi_timestamp char(14) binary NOT NULL default '', - - INDEX oi_name (oi_name(10)) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Record of deleted file data --- -CREATE TABLE /*$wgDBprefix*/filearchive ( - -- Unique row id - fa_id int NOT NULL auto_increment, - - -- Original base filename; key to image.img_name, page.page_title, etc - fa_name varchar(255) binary NOT NULL default '', - - -- Filename of archived file, if an old revision - fa_archive_name varchar(255) binary default '', - - -- Which storage bin (directory tree or object store) the file data - -- is stored in. Should be 'deleted' for files that have been deleted; - -- any other bin is not yet in use. - fa_storage_group varchar(16), - - -- SHA-1 of the file contents plus extension, used as a key for storage. - -- eg 8f8a562add37052a1848ff7771a2c515db94baa9.jpg - -- - -- If NULL, the file was missing at deletion time or has been purged - -- from the archival storage. - fa_storage_key varchar(64) binary default '', - - -- Deletion information, if this file is deleted. - fa_deleted_user int, - fa_deleted_timestamp char(14) binary default '', - fa_deleted_reason text, - - -- Duped fields from image - fa_size int(8) unsigned default '0', - fa_width int(5) default '0', - fa_height int(5) default '0', - fa_metadata mediumblob, - fa_bits int(3) default '0', - fa_media_type ENUM("UNKNOWN", "BITMAP", "DRAWING", "AUDIO", "VIDEO", "MULTIMEDIA", "OFFICE", "TEXT", "EXECUTABLE", "ARCHIVE") default NULL, - fa_major_mime ENUM("unknown", "application", "audio", "image", "text", "video", "message", "model", "multipart") default "unknown", - fa_minor_mime varchar(32) default "unknown", - fa_description tinyblob, - fa_user int(5) unsigned default '0', - fa_user_text varchar(255) binary default '', - fa_timestamp char(14) binary default '', - - PRIMARY KEY (fa_id), - INDEX (fa_name, fa_timestamp), -- pick out by image name - INDEX (fa_storage_group, fa_storage_key), -- pick out dupe files - INDEX (fa_deleted_timestamp), -- sort by deletion time - INDEX (fa_deleted_user) -- sort by deleter - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Primarily a summary table for Special:Recentchanges, --- this table contains some additional info on edits from --- the last few days, see Article::editUpdates() --- -CREATE TABLE /*$wgDBprefix*/recentchanges ( - rc_id int(8) NOT NULL auto_increment, - rc_timestamp varchar(14) binary NOT NULL default '', - rc_cur_time varchar(14) binary NOT NULL default '', - - -- As in revision - rc_user int(10) unsigned NOT NULL default '0', - rc_user_text varchar(255) binary NOT NULL default '', - - -- When pages are renamed, their RC entries do _not_ change. - rc_namespace int NOT NULL default '0', - rc_title varchar(255) binary NOT NULL default '', - - -- as in revision... - rc_comment varchar(255) binary NOT NULL default '', - rc_minor tinyint(3) unsigned NOT NULL default '0', - - -- Edits by user accounts with the 'bot' rights key are - -- marked with a 1 here, and will be hidden from the - -- default view. - rc_bot tinyint(3) unsigned NOT NULL default '0', - - rc_new tinyint(3) unsigned NOT NULL default '0', - - -- Key to page_id (was cur_id prior to 1.5). - -- This will keep links working after moves while - -- retaining the at-the-time name in the changes list. - rc_cur_id int(10) unsigned NOT NULL default '0', - - -- rev_id of the given revision - rc_this_oldid int(10) unsigned NOT NULL default '0', - - -- rev_id of the prior revision, for generating diff links. - rc_last_oldid int(10) unsigned NOT NULL default '0', - - -- These may no longer be used, with the new move log. - rc_type tinyint(3) unsigned NOT NULL default '0', - rc_moved_to_ns tinyint(3) unsigned NOT NULL default '0', - rc_moved_to_title varchar(255) binary NOT NULL default '', - - -- If the Recent Changes Patrol option is enabled, - -- users may mark edits as having been reviewed to - -- remove a warning flag on the RC list. - -- A value of 1 indicates the page has been reviewed. - rc_patrolled tinyint(3) unsigned NOT NULL default '0', - - -- Recorded IP address the edit was made from, if the - -- $wgPutIPinRC option is enabled. - rc_ip char(15) NOT NULL default '', - - -- Text length in characters before - -- and after the edit - rc_old_len int(10) default '0', - rc_new_len int(10) default '0', - - PRIMARY KEY rc_id (rc_id), - INDEX rc_timestamp (rc_timestamp), - INDEX rc_namespace_title (rc_namespace, rc_title), - INDEX rc_cur_id (rc_cur_id), - INDEX new_name_timestamp (rc_new,rc_namespace,rc_timestamp), - INDEX rc_ip (rc_ip), - INDEX rc_ns_usertext ( rc_namespace, rc_user_text ) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - -CREATE TABLE /*$wgDBprefix*/watchlist ( - -- Key to user.user_id - wl_user int(5) unsigned NOT NULL, - - -- Key to page_namespace/page_title - -- Note that users may watch pages which do not exist yet, - -- or existed in the past but have been deleted. - wl_namespace int NOT NULL default '0', - wl_title varchar(255) binary NOT NULL default '', - - -- Timestamp when user was last sent a notification e-mail; - -- cleared when the user visits the page. - wl_notificationtimestamp varchar(14) binary, - - UNIQUE KEY (wl_user, wl_namespace, wl_title), - KEY namespace_title (wl_namespace,wl_title) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - - --- --- Used by the math module to keep track --- of previously-rendered items. --- -CREATE TABLE /*$wgDBprefix*/math ( - -- Binary MD5 hash of the latex fragment, used as an identifier key. - math_inputhash varbinary(16) NOT NULL, - - -- Not sure what this is, exactly... - math_outputhash varbinary(16) NOT NULL, - - -- texvc reports how well it thinks the HTML conversion worked; - -- if it's a low level the PNG rendering may be preferred. - math_html_conservativeness tinyint(1) NOT NULL, - - -- HTML output from texvc, if any - math_html text, - - -- MathML output from texvc, if any - math_mathml text, - - UNIQUE KEY math_inputhash (math_inputhash) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- When using the default MySQL search backend, page titles --- and text are munged to strip markup, do Unicode case folding, --- and prepare the result for MySQL's fulltext index. --- --- This table must be MyISAM; InnoDB does not support the needed --- fulltext index. --- -CREATE TABLE /*$wgDBprefix*/searchindex ( - -- Key to page_id - si_page int(8) unsigned NOT NULL, - - -- Munged version of title - si_title varchar(255) NOT NULL default '', - - -- Munged version of body text - si_text mediumtext NOT NULL, - - UNIQUE KEY (si_page), - FULLTEXT si_title (si_title), - FULLTEXT si_text (si_text) - -) ENGINE=MyISAM, DEFAULT CHARSET=utf8; - --- --- Recognized interwiki link prefixes --- -CREATE TABLE /*$wgDBprefix*/interwiki ( - -- The interwiki prefix, (e.g. "Meatball", or the language prefix "de") - iw_prefix char(32) NOT NULL, - - -- The URL of the wiki, with "$1" as a placeholder for an article name. - -- Any spaces in the name will be transformed to underscores before - -- insertion. - iw_url char(127) NOT NULL, - - -- A boolean value indicating whether the wiki is in this project - -- (used, for example, to detect redirect loops) - iw_local bool NOT NULL, - - -- Boolean value indicating whether interwiki transclusions are allowed. - iw_trans tinyint(1) NOT NULL default 0, - - UNIQUE KEY iw_prefix (iw_prefix) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Used for caching expensive grouped queries --- -CREATE TABLE /*$wgDBprefix*/querycache ( - -- A key name, generally the base name of of the special page. - qc_type char(32) NOT NULL, - - -- Some sort of stored value. Sizes, counts... - qc_value int(5) unsigned NOT NULL default '0', - - -- Target namespace+title - qc_namespace int NOT NULL default '0', - qc_title char(255) binary NOT NULL default '', - - KEY (qc_type,qc_value) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- For a few generic cache operations if not using Memcached --- -CREATE TABLE /*$wgDBprefix*/objectcache ( - keyname char(255) binary NOT NULL default '', - value mediumblob, - exptime datetime, - UNIQUE KEY (keyname), - KEY (exptime) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- --- Cache of interwiki transclusion --- -CREATE TABLE /*$wgDBprefix*/transcache ( - tc_url varchar(255) NOT NULL, - tc_contents text, - tc_time int NOT NULL, - UNIQUE INDEX tc_url_idx (tc_url) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - -CREATE TABLE /*$wgDBprefix*/logging ( - -- Symbolic keys for the general log type and the action type - -- within the log. The output format will be controlled by the - -- action field, but only the type controls categorization. - log_type char(10) NOT NULL default '', - log_action char(10) NOT NULL default '', - - -- Timestamp. Duh. - log_timestamp char(14) NOT NULL default '19700101000000', - - -- The user who performed this action; key to user_id - log_user int unsigned NOT NULL default 0, - - -- Key to the page affected. Where a user is the target, - -- this will point to the user page. - log_namespace int NOT NULL default 0, - log_title varchar(255) binary NOT NULL default '', - - -- Freeform text. Interpreted as edit history comments. - log_comment varchar(255) NOT NULL default '', - - -- LF separated list of miscellaneous parameters - log_params blob NOT NULL, - - KEY type_time (log_type, log_timestamp), - KEY user_time (log_user, log_timestamp), - KEY page_time (log_namespace, log_title, log_timestamp) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - -CREATE TABLE /*$wgDBprefix*/trackbacks ( - tb_id int auto_increment, - tb_page int REFERENCES page(page_id) ON DELETE CASCADE, - tb_title varchar(255) NOT NULL, - tb_url varchar(255) NOT NULL, - tb_ex text, - tb_name varchar(255), - - PRIMARY KEY (tb_id), - INDEX (tb_page) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- Jobs performed by parallel apache threads or a command-line daemon -CREATE TABLE /*$wgDBprefix*/job ( - job_id int(9) unsigned NOT NULL auto_increment, - - -- Command name, currently only refreshLinks is defined - job_cmd varchar(255) NOT NULL default '', - - -- Namespace and title to act on - -- Should be 0 and '' if the command does not operate on a title - job_namespace int NOT NULL, - job_title varchar(255) binary NOT NULL, - - -- Any other parameters to the command - -- Presently unused, format undefined - job_params blob NOT NULL, - - PRIMARY KEY job_id (job_id), - KEY (job_cmd, job_namespace, job_title) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- Details of updates to cached special pages -CREATE TABLE /*$wgDBprefix*/querycache_info ( - - -- Special page name - -- Corresponds to a qc_type value - qci_type varchar(32) NOT NULL default '', - - -- Timestamp of last update - qci_timestamp char(14) NOT NULL default '19700101000000', - - UNIQUE KEY ( qci_type ) - -) ENGINE=InnoDB; - --- For each redirect, this table contains exactly one row defining its target -CREATE TABLE /*$wgDBprefix*/redirect ( - -- Key to the page_id of the redirect page - rd_from int(8) unsigned NOT NULL default '0', - - -- Key to page_namespace/page_title of the target page. - -- The target page may or may not exist, and due to renames - -- and deletions may refer to different page records as time - -- goes by. - rd_namespace int NOT NULL default '0', - rd_title varchar(255) binary NOT NULL default '', - - PRIMARY KEY rd_from (rd_from), - KEY rd_ns_title (rd_namespace,rd_title,rd_from) -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; - --- Used for caching expensive grouped queries that need two links (for example double-redirects) - -CREATE TABLE /*$wgDBprefix*/querycachetwo ( - -- A key name, generally the base name of of the special page. - qcc_type char(32) NOT NULL, - - -- Some sort of stored value. Sizes, counts... - qcc_value int(5) unsigned NOT NULL default '0', - - -- Target namespace+title - qcc_namespace int NOT NULL default '0', - qcc_title char(255) binary NOT NULL default '', - - -- Target namespace+title2 - qcc_namespacetwo int NOT NULL default '0', - qcc_titletwo char(255) binary NOT NULL default '', - - KEY qcc_type (qcc_type,qcc_value), - KEY qcc_title (qcc_type,qcc_namespace,qcc_title), - KEY qcc_titletwo (qcc_type,qcc_namespacetwo,qcc_titletwo) - -) ENGINE=InnoDB, DEFAULT CHARSET=utf8; diff --git a/maintenance/oracle/archives/patch-trackbacks.sql b/maintenance/oracle/archives/patch-trackbacks.sql deleted file mode 100644 index 15d4eef1..00000000 --- a/maintenance/oracle/archives/patch-trackbacks.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE SEQUENCE trackbacks_id_seq; -CREATE TABLE trackbacks ( - tb_id NUMBER PRIMARY KEY, - tb_page NUMBER(8) REFERENCES page(page_id) ON DELETE CASCADE, - tb_title VARCHAR(255) NOT NULL, - tb_url VARCHAR(255) NOT NULL, - tb_ex CLOB, - tb_name VARCHAR(255) -); -CREATE INDEX tb_name_page_idx ON trackbacks(tb_page); diff --git a/maintenance/oracle/archives/patch-transcache.sql b/maintenance/oracle/archives/patch-transcache.sql deleted file mode 100644 index 62ad2c7d..00000000 --- a/maintenance/oracle/archives/patch-transcache.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE transcache ( - tc_url VARCHAR2(255) NOT NULL UNIQUE, - tc_contents CLOB, - tc_time TIMESTAMP NOT NULL -); diff --git a/maintenance/oracle/interwiki.sql b/maintenance/oracle/interwiki.sql deleted file mode 100644 index 09d01c64..00000000 --- a/maintenance/oracle/interwiki.sql +++ /dev/null @@ -1,178 +0,0 @@ --- Based more or less on the public interwiki map from MeatballWiki --- Default interwiki prefixes... - -CALL add_interwiki('abbenormal','http://www.ourpla.net/cgi-bin/pikie.cgi?$1',0); -CALL add_interwiki('acadwiki','http://xarch.tu-graz.ac.at/autocad/wiki/$1',0); -CALL add_interwiki('acronym','http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=$1',0); -CALL add_interwiki('advogato','http://www.advogato.org/$1',0); -CALL add_interwiki('aiwiki','http://www.ifi.unizh.ch/ailab/aiwiki/aiw.cgi?$1',0); -CALL add_interwiki('alife','http://news.alife.org/wiki/index.php?$1',0); -CALL add_interwiki('annotation','http://bayle.stanford.edu/crit/nph-med.cgi/$1',0); -CALL add_interwiki('annotationwiki','http://www.seedwiki.com/page.cfm?wikiid=368&doc=$1',0); -CALL add_interwiki('arxiv','http://www.arxiv.org/abs/$1',0); -CALL add_interwiki('aspienetwiki','http://aspie.mela.de/Wiki/index.php?title=$1',0); -CALL add_interwiki('bemi','http://bemi.free.fr/vikio/index.php?$1',0); -CALL add_interwiki('benefitswiki','http://www.benefitslink.com/cgi-bin/wiki.cgi?$1',0); -CALL add_interwiki('brasilwiki','http://rio.ifi.unizh.ch/brasilienwiki/index.php/$1',0); -CALL add_interwiki('bridgeswiki','http://c2.com/w2/bridges/$1',0); -CALL add_interwiki('c2find','http://c2.com/cgi/wiki?FindPage&value=$1',0); -CALL add_interwiki('cache','http://www.google.com/search?q=cache:$1',0); -CALL add_interwiki('ciscavate','http://ciscavate.org/index.php/$1',0); -CALL add_interwiki('cliki','http://ww.telent.net/cliki/$1',0); -CALL add_interwiki('cmwiki','http://www.ourpla.net/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('codersbase','http://www.codersbase.com/$1',0); -CALL add_interwiki('commons','http://commons.wikimedia.org/wiki/$1',0); -CALL add_interwiki('consciousness','http://teadvus.inspiral.org/',0); -CALL add_interwiki('corpknowpedia','http://corpknowpedia.org/wiki/index.php/$1',0); -CALL add_interwiki('creationmatters','http://www.ourpla.net/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('dejanews','http://www.deja.com/=dnc/getdoc.xp?AN=$1',0); -CALL add_interwiki('demokraatia','http://wiki.demokraatia.ee/',0); -CALL add_interwiki('dictionary','http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',0); -CALL add_interwiki('disinfopedia','http://www.disinfopedia.org/wiki.phtml?title=$1',0); -CALL add_interwiki('diveintoosx','http://diveintoosx.org/$1',0); -CALL add_interwiki('docbook','http://docbook.org/wiki/moin.cgi/$1',0); -CALL add_interwiki('dolphinwiki','http://www.object-arts.com/wiki/html/Dolphin/$1',0); -CALL add_interwiki('drumcorpswiki','http://www.drumcorpswiki.com/index.php/$1',0); -CALL add_interwiki('dwjwiki','http://www.suberic.net/cgi-bin/dwj/wiki.cgi?$1',0); -CALL add_interwiki('eĉei','http://www.ikso.net/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('echei','http://www.ikso.net/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('ecxei','http://www.ikso.net/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('efnetceewiki','http://purl.net/wiki/c/$1',0); -CALL add_interwiki('efnetcppwiki','http://purl.net/wiki/cpp/$1',0); -CALL add_interwiki('efnetpythonwiki','http://purl.net/wiki/python/$1',0); -CALL add_interwiki('efnetxmlwiki','http://purl.net/wiki/xml/$1',0); -CALL add_interwiki('eljwiki','http://elj.sourceforge.net/phpwiki/index.php/$1',0); -CALL add_interwiki('emacswiki','http://www.emacswiki.org/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('elibre','http://enciclopedia.us.es/index.php/$1',0); -CALL add_interwiki('eokulturcentro','http://esperanto.toulouse.free.fr/wakka.php?wiki=$1',0); -CALL add_interwiki('evowiki','http://www.evowiki.org/index.php/$1',0); -CALL add_interwiki('finalempire','http://final-empire.sourceforge.net/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('firstwiki','http://firstwiki.org/index.php/$1',0); -CALL add_interwiki('foldoc','http://www.foldoc.org/foldoc/foldoc.cgi?$1',0); -CALL add_interwiki('foxwiki','http://fox.wikis.com/wc.dll?Wiki~$1',0); -CALL add_interwiki('fr.be','http://fr.wikinations.be/$1',0); -CALL add_interwiki('fr.ca','http://fr.ca.wikinations.org/$1',0); -CALL add_interwiki('fr.fr','http://fr.fr.wikinations.org/$1',0); -CALL add_interwiki('fr.org','http://fr.wikinations.org/$1',0); -CALL add_interwiki('freebsdman','http://www.FreeBSD.org/cgi/man.cgi?apropos=1&query=$1',0); -CALL add_interwiki('gamewiki','http://gamewiki.org/wiki/index.php/$1',0); -CALL add_interwiki('gej','http://www.esperanto.de/cgi-bin/aktivikio/wiki.pl?$1',0); -CALL add_interwiki('gentoo-wiki','http://gentoo-wiki.com/$1',0); -CALL add_interwiki('globalvoices','http://cyber.law.harvard.edu/dyn/globalvoices/wiki/$1',0); -CALL add_interwiki('gmailwiki','http://www.gmailwiki.com/index.php/$1',0); -CALL add_interwiki('google','http://www.google.com/search?q=$1',0); -CALL add_interwiki('googlegroups','http://groups.google.com/groups?q=$1',0); -CALL add_interwiki('gotamac','http://www.got-a-mac.org/$1',0); -CALL add_interwiki('greencheese','http://www.greencheese.org/$1',0); -CALL add_interwiki('hammondwiki','http://www.dairiki.org/HammondWiki/index.php3?$1',0); -CALL add_interwiki('haribeau','http://wiki.haribeau.de/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('hewikisource','http://he.wikisource.org/wiki/$1',1); -CALL add_interwiki('herzkinderwiki','http://www.herzkinderinfo.de/Mediawiki/index.php/$1',0); -CALL add_interwiki('hrwiki','http://www.hrwiki.org/index.php/$1',0); -CALL add_interwiki('iawiki','http://www.IAwiki.net/$1',0); -CALL add_interwiki('imdb','http://us.imdb.com/Title?$1',0); -CALL add_interwiki('infosecpedia','http://www.infosecpedia.org/pedia/index.php/$1',0); -CALL add_interwiki('jargonfile','http://sunir.org/apps/meta.pl?wiki=JargonFile&redirect=$1',0); -CALL add_interwiki('jefo','http://www.esperanto-jeunes.org/vikio/index.php?$1',0); -CALL add_interwiki('jiniwiki','http://www.cdegroot.com/cgi-bin/jini?$1',0); -CALL add_interwiki('jspwiki','http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=$1',0); -CALL add_interwiki('kerimwiki','http://wiki.oxus.net/$1',0); -CALL add_interwiki('kmwiki','http://www.voght.com/cgi-bin/pywiki?$1',0); -CALL add_interwiki('knowhow','http://www2.iro.umontreal.ca/~paquetse/cgi-bin/wiki.cgi?$1',0); -CALL add_interwiki('lanifexwiki','http://opt.lanifex.com/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('lasvegaswiki','http://wiki.gmnow.com/index.php/$1',0); -CALL add_interwiki('linuxwiki','http://www.linuxwiki.de/$1',0); -CALL add_interwiki('lojban','http://www.lojban.org/tiki/tiki-index.php?page=$1',0); -CALL add_interwiki('lqwiki','http://wiki.linuxquestions.org/wiki/$1',0); -CALL add_interwiki('lugkr','http://lug-kr.sourceforge.net/cgi-bin/lugwiki.pl?$1',0); -CALL add_interwiki('lutherwiki','http://www.lutheranarchives.com/mw/index.php/$1',0); -CALL add_interwiki('mathsongswiki','http://SeedWiki.com/page.cfm?wikiid=237&doc=$1',0); -CALL add_interwiki('mbtest','http://www.usemod.com/cgi-bin/mbtest.pl?$1',0); -CALL add_interwiki('meatball','http://www.usemod.com/cgi-bin/mb.pl?$1',0); -CALL add_interwiki('mediazilla','http://bugzilla.wikipedia.org/$1',1); -CALL add_interwiki('memoryalpha','http://www.memory-alpha.org/en/index.php/$1',0); -CALL add_interwiki('metaweb','http://www.metaweb.com/wiki/wiki.phtml?title=$1',0); -CALL add_interwiki('metawiki','http://sunir.org/apps/meta.pl?$1',0); -CALL add_interwiki('metawikipedia','http://meta.wikimedia.org/wiki/$1',0); -CALL add_interwiki('moinmoin','http://purl.net/wiki/moin/$1',0); -CALL add_interwiki('mozillawiki','http://wiki.mozilla.org/index.php/$1',0); -CALL add_interwiki('muweb','http://www.dunstable.com/scripts/MuWebWeb?$1',0); -CALL add_interwiki('netvillage','http://www.netbros.com/?$1',0); -CALL add_interwiki('oeis','http://www.research.att.com/cgi-bin/access.cgi/as/njas/sequences/eisA.cgi?Anum=$1',0); -CALL add_interwiki('openfacts','http://openfacts.berlios.de/index.phtml?title=$1',0); -CALL add_interwiki('openwiki','http://openwiki.com/?$1',0); -CALL add_interwiki('opera7wiki','http://nontroppo.org/wiki/$1',0); -CALL add_interwiki('orgpatterns','http://www.bell-labs.com/cgi-user/OrgPatterns/OrgPatterns?$1',0); -CALL add_interwiki('osi reference model','http://wiki.tigma.ee/',0); -CALL add_interwiki('pangalacticorg','http://www.pangalactic.org/Wiki/$1',0); -CALL add_interwiki('personaltelco','http://www.personaltelco.net/index.cgi/$1',0); -CALL add_interwiki('patwiki','http://gauss.ffii.org/$1',0); -CALL add_interwiki('phpwiki','http://phpwiki.sourceforge.net/phpwiki/index.php?$1',0); -CALL add_interwiki('pikie','http://pikie.darktech.org/cgi/pikie?$1',0); -CALL add_interwiki('pmeg','http://www.bertilow.com/pmeg/$1.php',0); -CALL add_interwiki('ppr','http://c2.com/cgi/wiki?$1',0); -CALL add_interwiki('purlnet','http://purl.oclc.org/NET/$1',0); -CALL add_interwiki('pythoninfo','http://www.python.org/cgi-bin/moinmoin/$1',0); -CALL add_interwiki('pythonwiki','http://www.pythonwiki.de/$1',0); -CALL add_interwiki('pywiki','http://www.voght.com/cgi-bin/pywiki?$1',0); -CALL add_interwiki('raec','http://www.raec.clacso.edu.ar:8080/raec/Members/raecpedia/$1',0); -CALL add_interwiki('revo','http://purl.org/NET/voko/revo/art/$1.html',0); -CALL add_interwiki('rfc','http://www.rfc-editor.org/rfc/rfc$1.txt',0); -CALL add_interwiki('s23wiki','http://is-root.de/wiki/index.php/$1',0); -CALL add_interwiki('scoutpedia','http://www.scoutpedia.info/index.php/$1',0); -CALL add_interwiki('seapig','http://www.seapig.org/$1',0); -CALL add_interwiki('seattlewiki','http://seattlewiki.org/wiki/$1',0); -CALL add_interwiki('seattlewireless','http://seattlewireless.net/?$1',0); -CALL add_interwiki('seeds','http://www.IslandSeeds.org/wiki/$1',0); -CALL add_interwiki('senseislibrary','http://senseis.xmp.net/?$1',0); -CALL add_interwiki('shakti','http://cgi.algonet.se/htbin/cgiwrap/pgd/ShaktiWiki/$1',0); -CALL add_interwiki('slashdot','http://slashdot.org/article.pl?sid=$1',0); -CALL add_interwiki('smikipedia','http://www.smikipedia.org/$1',0); -CALL add_interwiki('sockwiki','http://wiki.socklabs.com/$1',0); -CALL add_interwiki('sourceforge','http://sourceforge.net/$1',0); -CALL add_interwiki('squeak','http://minnow.cc.gatech.edu/squeak/$1',0); -CALL add_interwiki('strikiwiki','http://ch.twi.tudelft.nl/~mostert/striki/teststriki.pl?$1',0); -CALL add_interwiki('susning','http://www.susning.nu/$1',0); -CALL add_interwiki('svgwiki','http://www.protocol7.com/svg-wiki/default.asp?$1',0); -CALL add_interwiki('tavi','http://tavi.sourceforge.net/$1',0); -CALL add_interwiki('tejo','http://www.tejo.org/vikio/$1',0); -CALL add_interwiki('terrorwiki','http://www.liberalsagainstterrorism.com/wiki/index.php/$1',0); -CALL add_interwiki('tmbw','http://www.tmbw.net/wiki/index.php/$1',0); -CALL add_interwiki('tmnet','http://www.technomanifestos.net/?$1',0); -CALL add_interwiki('tmwiki','http://www.EasyTopicMaps.com/?page=$1',0); -CALL add_interwiki('turismo','http://www.tejo.org/turismo/$1',0); -CALL add_interwiki('theopedia','http://www.theopedia.com/$1',0); -CALL add_interwiki('twiki','http://twiki.org/cgi-bin/view/$1',0); -CALL add_interwiki('twistedwiki','http://purl.net/wiki/twisted/$1',0); -CALL add_interwiki('uea','http://www.tejo.org/uea/$1',0); -CALL add_interwiki('unreal','http://wiki.beyondunreal.com/wiki/$1',0); -CALL add_interwiki('ursine','http://ursine.ca/$1',0); -CALL add_interwiki('usej','http://www.tejo.org/usej/$1',0); -CALL add_interwiki('usemod','http://www.usemod.com/cgi-bin/wiki.pl?$1',0); -CALL add_interwiki('visualworks','http://wiki.cs.uiuc.edu/VisualWorks/$1',0); -CALL add_interwiki('warpedview','http://www.warpedview.com/index.php/$1',0); -CALL add_interwiki('webdevwikinl','http://www.promo-it.nl/WebDevWiki/index.php?page=$1',0); -CALL add_interwiki('webisodes','http://www.webisodes.org/$1',0); -CALL add_interwiki('webseitzwiki','http://webseitz.fluxent.com/wiki/$1',0); -CALL add_interwiki('why','http://clublet.com/c/c/why?$1',0); -CALL add_interwiki('wiki','http://c2.com/cgi/wiki?$1',0); -CALL add_interwiki('wikia','http://www.wikia.com/wiki/index.php/$1',0); -CALL add_interwiki('wikibooks','http://en.wikibooks.org/wiki/$1',1); -CALL add_interwiki('wikicities','http://www.wikicities.com/index.php/$1',0); -CALL add_interwiki('wikif1','http://www.wikif1.org/$1',0); -CALL add_interwiki('wikinfo','http://www.wikinfo.org/wiki.php?title=$1',0); -CALL add_interwiki('wikimedia','http://wikimediafoundation.org/wiki/$1',0); -CALL add_interwiki('wikiquote','http://en.wikiquote.org/wiki/$1',1); -CALL add_interwiki('wikinews','http://en.wikinews.org/wiki/$1',0); -CALL add_interwiki('wikisource','http://sources.wikipedia.org/wiki/$1',1); -CALL add_interwiki('wikispecies','http://species.wikipedia.org/wiki/$1',1); -CALL add_interwiki('wikitravel','http://wikitravel.org/en/$1',0); -CALL add_interwiki('wikiworld','http://WikiWorld.com/wiki/index.php/$1',0); -CALL add_interwiki('wiktionary','http://en.wiktionary.org/wiki/$1',1); -CALL add_interwiki('wlug','http://www.wlug.org.nz/$1',0); -CALL add_interwiki('wlwiki','http://winslowslair.supremepixels.net/wiki/index.php/$1',0); -CALL add_interwiki('ypsieyeball','http://sknkwrks.dyndns.org:1957/writewiki/wiki.pl?$1',0); -CALL add_interwiki('zwiki','http://www.zwiki.org/$1',0); -CALL add_interwiki('zzz wiki','http://wiki.zzz.ee/',0); -CALL add_interwiki('wikt','http://en.wiktionary.org/wiki/$1',1); - diff --git a/maintenance/oracle/tables.sql b/maintenance/oracle/tables.sql deleted file mode 100644 index 030f427f..00000000 --- a/maintenance/oracle/tables.sql +++ /dev/null @@ -1,335 +0,0 @@ --- SQL to create the initial tables for the MediaWiki database. --- This is read and executed by the install script; you should --- not have to run it by itself unless doing a manual install. - -CREATE SEQUENCE user_user_id_seq; - -CREATE TABLE "user" ( - user_id NUMBER(5) NOT NULL PRIMARY KEY, - user_name VARCHAR2(255) DEFAULT '' NOT NULL, - user_real_name VARCHAR2(255) DEFAULT '', - user_password VARCHAR2(128) DEFAULT '', - user_newpassword VARCHAR2(128) default '', - user_email VARCHAR2(255) default '', - user_options CLOB default '', - user_touched TIMESTAMP WITH TIME ZONE, - user_token CHAR(32) default '', - user_email_authenticated TIMESTAMP WITH TIME ZONE DEFAULT NULL, - user_email_token CHAR(32), - user_email_token_expires TIMESTAMP WITH TIME ZONE DEFAULT NULL -); -CREATE UNIQUE INDEX user_name_idx ON "user" (user_name); -CREATE INDEX user_email_token_idx ON "user" (user_email_token); - -CREATE TABLE user_groups ( - ug_user NUMBER(5) DEFAULT '0' NOT NULL - REFERENCES "user" (user_id) - ON DELETE CASCADE, - ug_group VARCHAR2(16) NOT NULL, - CONSTRAINT user_groups_pk PRIMARY KEY (ug_user, ug_group) -); -CREATE INDEX user_groups_group_idx ON user_groups(ug_group); - -CREATE TABLE user_newtalk ( - user_id NUMBER(5) DEFAULT 0 NOT NULL, - user_ip VARCHAR2(40) DEFAULT '' NOT NULL -); -CREATE INDEX user_newtalk_id_idx ON user_newtalk(user_id); -CREATE INDEX user_newtalk_ip_idx ON user_newtalk(user_ip); - -CREATE SEQUENCE page_page_id_seq; -CREATE TABLE page ( - page_id NUMBER(8) NOT NULL PRIMARY KEY, - page_namespace NUMBER(5) NOT NULL, - page_title VARCHAR(255) NOT NULL, - page_restrictions CLOB DEFAULT '', - page_counter NUMBER(20) DEFAULT 0 NOT NULL, - page_is_redirect NUMBER(1) DEFAULT 0 NOT NULL, - page_is_new NUMBER(1) DEFAULT 0 NOT NULL, - page_random NUMBER(25, 24) NOT NULL, - page_touched TIMESTAMP WITH TIME ZONE, - page_latest NUMBER(8) NOT NULL, - page_len NUMBER(8) DEFAULT 0 -); -CREATE UNIQUE INDEX page_id_namespace_title_idx ON page(page_namespace, page_title); -CREATE INDEX page_random_idx ON page(page_random); -CREATE INDEX page_len_idx ON page(page_len); - -CREATE SEQUENCE rev_rev_id_val; -CREATE TABLE revision ( - rev_id NUMBER(8) NOT NULL, - rev_page NUMBER(8) NOT NULL - REFERENCES page (page_id) - ON DELETE CASCADE, - rev_text_id NUMBER(8) NOT NULL, - rev_comment CLOB, - rev_user NUMBER(8) DEFAULT 0 NOT NULL, - rev_user_text VARCHAR2(255) DEFAULT '' NOT NULL, - rev_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, - rev_minor_edit NUMBER(1) DEFAULT 0 NOT NULL, - rev_deleted NUMBER(1) DEFAULT 0 NOT NULL, - CONSTRAINT revision_pk PRIMARY KEY (rev_page, rev_id) -); - -CREATE UNIQUE INDEX rev_id_idx ON revision(rev_id); -CREATE INDEX rev_timestamp_idx ON revision(rev_timestamp); -CREATE INDEX rev_page_timestamp_idx ON revision(rev_page, rev_timestamp); -CREATE INDEX rev_user_timestamp_idx ON revision(rev_user, rev_timestamp); -CREATE INDEX rev_usertext_timestamp_idx ON revision(rev_user_text, rev_timestamp); - -CREATE SEQUENCE text_old_id_val; - -CREATE TABLE text ( - old_id NUMBER(8) NOT NULL, - old_text CLOB, - old_flags CLOB, - CONSTRAINT text_pk PRIMARY KEY (old_id) -); - -CREATE TABLE archive ( - ar_namespace NUMBER(5) NOT NULL, - ar_title VARCHAR2(255) NOT NULL, - ar_text CLOB, - ar_comment CLOB, - ar_user NUMBER(8), - ar_user_text VARCHAR2(255) NOT NULL, - ar_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, - ar_minor_edit NUMBER(1) DEFAULT 0 NOT NULL, - ar_flags CLOB, - ar_rev_id NUMBER(8), - ar_text_id NUMBER(8) -); -CREATE INDEX archive_name_title_timestamp ON archive(ar_namespace,ar_title,ar_timestamp); - -CREATE TABLE pagelinks ( - pl_from NUMBER(8) NOT NULL - REFERENCES page(page_id) - ON DELETE CASCADE, - pl_namespace NUMBER(4) DEFAULT 0 NOT NULL, - pl_title VARCHAR2(255) NOT NULL -); -CREATE UNIQUE INDEX pl_from ON pagelinks(pl_from, pl_namespace, pl_title); -CREATE INDEX pl_namespace ON pagelinks(pl_namespace, pl_title, pl_from); - -CREATE TABLE imagelinks ( - il_from NUMBER(8) NOT NULL REFERENCES page(page_id) ON DELETE CASCADE, - il_to VARCHAR2(255) NOT NULL -); -CREATE UNIQUE INDEX il_from ON imagelinks(il_from, il_to); -CREATE INDEX il_to ON imagelinks(il_to, il_from); - -CREATE TABLE categorylinks ( - cl_from NUMBER(8) NOT NULL REFERENCES page(page_id) ON DELETE CASCADE, - cl_to VARCHAR2(255) NOT NULL, - cl_sortkey VARCHAR2(86) default '', - cl_timestamp TIMESTAMP WITH TIME ZONE NOT NULL -); -CREATE UNIQUE INDEX cl_from ON categorylinks(cl_from, cl_to); -CREATE INDEX cl_sortkey ON categorylinks(cl_to, cl_sortkey); -CREATE INDEX cl_timestamp ON categorylinks(cl_to, cl_timestamp); - --- --- Contains a single row with some aggregate info --- on the state of the site. --- -CREATE TABLE site_stats ( - ss_row_id NUMBER(8) NOT NULL, - ss_total_views NUMBER(20) default 0, - ss_total_edits NUMBER(20) default 0, - ss_good_articles NUMBER(20) default 0, - ss_total_pages NUMBER(20) default -1, - ss_users NUMBER(20) default -1, - ss_admins NUMBER(10) default -1 -); -CREATE UNIQUE INDEX ss_row_id ON site_stats(ss_row_id); - --- --- Stores an ID for every time any article is visited; --- depending on $wgHitcounterUpdateFreq, it is --- periodically cleared and the page_counter column --- in the page table updated for the all articles --- that have been visited.) --- -CREATE TABLE hitcounter ( - hc_id NUMBER NOT NULL -); - --- --- The internet is full of jerks, alas. Sometimes it's handy --- to block a vandal or troll account. --- -CREATE SEQUENCE ipblocks_ipb_id_val; -CREATE TABLE ipblocks ( - ipb_id NUMBER(8) NOT NULL, - ipb_address VARCHAR2(40), - ipb_user NUMBER(8), - ipb_by NUMBER(8) NOT NULL - REFERENCES "user" (user_id) - ON DELETE CASCADE, - ipb_reason CLOB, - ipb_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, - ipb_auto NUMBER(1) DEFAULT 0 NOT NULL, - ipb_expiry TIMESTAMP WITH TIME ZONE, - CONSTRAINT ipblocks_pk PRIMARY KEY (ipb_id) -); -CREATE INDEX ipb_address ON ipblocks(ipb_address); -CREATE INDEX ipb_user ON ipblocks(ipb_user); - -CREATE TABLE image ( - img_name VARCHAR2(255) NOT NULL, - img_size NUMBER(8) NOT NULL, - img_width NUMBER(5) NOT NULL, - img_height NUMBER(5) NOT NULL, - img_metadata CLOB, - img_bits NUMBER(3), - img_media_type VARCHAR2(10), - img_major_mime VARCHAR2(12) DEFAULT 'unknown', - img_minor_mime VARCHAR2(32) DEFAULT 'unknown', - img_description CLOB NOT NULL, - img_user NUMBER(8) NOT NULL REFERENCES "user"(user_id) ON DELETE CASCADE, - img_user_text VARCHAR2(255) NOT NULL, - img_timestamp TIMESTAMP WITH TIME ZONE, - CONSTRAINT image_pk PRIMARY KEY (img_name) -); -CREATE INDEX img_size_idx ON image(img_size); -CREATE INDEX img_timestamp_idx ON image(img_timestamp); - -CREATE TABLE oldimage ( - oi_name VARCHAR2(255) NOT NULL, - oi_archive_name VARCHAR2(255) NOT NULL, - oi_size NUMBER(8) NOT NULL, - oi_width NUMBER(5) NOT NULL, - oi_height NUMBER(5) NOT NULL, - oi_bits NUMBER(3) NOT NULL, - oi_description CLOB, - oi_user NUMBER(8) NOT NULL REFERENCES "user"(user_id), - oi_user_text VARCHAR2(255) NOT NULL, - oi_timestamp TIMESTAMP WITH TIME ZONE NOT NULL -); -CREATE INDEX oi_name ON oldimage (oi_name); - -CREATE SEQUENCE rc_rc_id_seq; -CREATE TABLE recentchanges ( - rc_id NUMBER(8) NOT NULL, - rc_timestamp TIMESTAMP WITH TIME ZONE, - rc_cur_time TIMESTAMP WITH TIME ZONE, - rc_user NUMBER(8) DEFAULT 0 NOT NULL, - rc_user_text VARCHAR2(255), - rc_namespace NUMBER(4) DEFAULT 0 NOT NULL, - rc_title VARCHAR2(255) NOT NULL, - rc_comment VARCHAR2(255), - rc_minor NUMBER(3) DEFAULT 0 NOT NULL, - rc_bot NUMBER(3) DEFAULT 0 NOT NULL, - rc_new NUMBER(3) DEFAULT 0 NOT NULL, - rc_cur_id NUMBER(8), - rc_this_oldid NUMBER(8) NOT NULL, - rc_last_oldid NUMBER(8) NOT NULL, - rc_type NUMBER(3) DEFAULT 0 NOT NULL, - rc_moved_to_ns NUMBER(3), - rc_moved_to_title VARCHAR2(255), - rc_patrolled NUMBER(3) DEFAULT 0 NOT NULL, - rc_ip VARCHAR2(40), - rc_old_len NUMBER(10) DEFAULT 0, - rc_new_len NUMBER(10) DEFAULT 0, - CONSTRAINT rc_pk PRIMARY KEY (rc_id) -); -CREATE INDEX rc_timestamp ON recentchanges (rc_timestamp); -CREATE INDEX rc_namespace_title ON recentchanges(rc_namespace, rc_title); -CREATE INDEX rc_cur_id ON recentchanges(rc_cur_id); -CREATE INDEX new_name_timestamp ON recentchanges(rc_new, rc_namespace, rc_timestamp); -CREATE INDEX rc_ip ON recentchanges(rc_ip); - -CREATE TABLE watchlist ( - wl_user NUMBER(8) NOT NULL - REFERENCES "user"(user_id) - ON DELETE CASCADE, - wl_namespace NUMBER(8) DEFAULT 0 NOT NULL, - wl_title VARCHAR2(255) NOT NULL, - wl_notificationtimestamp TIMESTAMP WITH TIME ZONE DEFAULT NULL -); -CREATE UNIQUE INDEX wl_user_namespace_title ON watchlist - (wl_user, wl_namespace, wl_title); -CREATE INDEX wl_namespace_title ON watchlist(wl_namespace, wl_title); - --- --- Used by texvc math-rendering extension to keep track --- of previously-rendered items. --- -CREATE TABLE math ( - math_inputhash VARCHAR2(16) NOT NULL UNIQUE, - math_outputhash VARCHAR2(16) NOT NULL, - math_html_conservativeness NUMBER(1) NOT NULL, - math_html CLOB, - math_mathml CLOB -); - --- --- Recognized interwiki link prefixes --- -CREATE TABLE interwiki ( - iw_prefix VARCHAR2(32) NOT NULL UNIQUE, - iw_url VARCHAR2(127) NOT NULL, - iw_local NUMBER(1) NOT NULL, - iw_trans NUMBER(1) DEFAULT 0 NOT NULL -); - -CREATE TABLE querycache ( - qc_type VARCHAR2(32) NOT NULL, - qc_value NUMBER(5) DEFAULT 0 NOT NULL, - qc_namespace NUMBER(4) DEFAULT 0 NOT NULL, - qc_title VARCHAR2(255) -); -CREATE INDEX querycache_type_value ON querycache(qc_type, qc_value); - --- --- For a few generic cache operations if not using Memcached --- -CREATE TABLE objectcache ( - keyname CHAR(255) DEFAULT '', - value CLOB, - exptime TIMESTAMP WITH TIME ZONE -); -CREATE UNIQUE INDEX oc_keyname_idx ON objectcache(keyname); -CREATE INDEX oc_exptime_idx ON objectcache(exptime); - -CREATE TABLE logging ( - log_type VARCHAR2(10) NOT NULL, - log_action VARCHAR2(10) NOT NULL, - log_timestamp TIMESTAMP WITH TIME ZONE NOT NULL, - log_user NUMBER(8) REFERENCES "user"(user_id), - log_namespace NUMBER(4), - log_title VARCHAR2(255) NOT NULL, - log_comment VARCHAR2(255), - log_params CLOB -); -CREATE INDEX logging_type_name ON logging(log_type, log_timestamp); -CREATE INDEX logging_user_time ON logging(log_user, log_timestamp); -CREATE INDEX logging_page_time ON logging(log_namespace, log_title, log_timestamp); - --- Hold group name and description ---CREATE TABLE /*$wgDBprefix*/groups ( --- gr_id int(5) unsigned NOT NULL auto_increment, --- gr_name varchar(50) NOT NULL default '', --- gr_description varchar(255) NOT NULL default '', --- gr_rights tinyblob, --- PRIMARY KEY (gr_id) --- ---) TYPE=InnoDB; - -CREATE OR REPLACE PROCEDURE add_user_right (name VARCHAR2, new_right VARCHAR2) AS - user_id "user".user_id%TYPE;; - user_is_missing EXCEPTION;; -BEGIN - SELECT user_id INTO user_id FROM "user" WHERE user_name = name;; - INSERT INTO user_groups (ug_user, ug_group) VALUES(user_id, new_right);; -EXCEPTION - WHEN NO_DATA_FOUND THEN - DBMS_OUTPUT.PUT_LINE('The specified user does not exist.');; -END add_user_right;; -; - -CREATE OR REPLACE PROCEDURE add_interwiki (prefix VARCHAR2, url VARCHAR2, is_local NUMBER) AS -BEGIN - INSERT INTO interwiki (iw_prefix, iw_url, iw_local) VALUES(prefix, url, is_local);; -END add_interwiki;; -;
\ No newline at end of file diff --git a/maintenance/postgres/archives/patch-archive-ar_deleted.sql b/maintenance/postgres/archives/patch-archive-ar_deleted.sql deleted file mode 100644 index 08bc1e37..00000000 --- a/maintenance/postgres/archives/patch-archive-ar_deleted.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE archive ADD ar_deleted INTEGER NOT NULL DEFAULT '0'; diff --git a/maintenance/postgres/archives/patch-archive2.sql b/maintenance/postgres/archives/patch-archive2.sql deleted file mode 100644 index fa900cbf..00000000 --- a/maintenance/postgres/archives/patch-archive2.sql +++ /dev/null @@ -1,15 +0,0 @@ -ALTER TABLE archive RENAME to archive2; -CREATE VIEW archive AS -SELECT - ar_namespace, ar_title, ar_text, ar_comment, ar_user, ar_user_text, - ar_minor_edit, ar_flags, ar_rev_id, ar_text_id, - TO_CHAR(ar_timestamp, 'YYYYMMDDHH24MISS') AS ar_timestamp -FROM archive2; - -CREATE RULE archive_insert AS ON INSERT TO archive -DO INSTEAD INSERT INTO archive2 VALUES ( - NEW.ar_namespace, NEW.ar_title, NEW.ar_text, NEW.ar_comment, NEW.ar_user, NEW.ar_user_text, - TO_DATE(NEW.ar_timestamp, 'YYYYMMDDHH24MISS'), - NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id -); - diff --git a/maintenance/postgres/archives/patch-archive_delete.sql b/maintenance/postgres/archives/patch-archive_delete.sql deleted file mode 100644 index 4a864c3b..00000000 --- a/maintenance/postgres/archives/patch-archive_delete.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE RULE archive_delete AS ON DELETE TO archive -DO INSTEAD DELETE FROM archive2 WHERE - archive2.ar_title = OLD.ar_title AND - archive2.ar_namespace = OLD.ar_namespace AND - archive2.ar_rev_id = OLD.ar_rev_id; diff --git a/maintenance/postgres/archives/patch-archive_insert.sql b/maintenance/postgres/archives/patch-archive_insert.sql deleted file mode 100644 index ca13d2a2..00000000 --- a/maintenance/postgres/archives/patch-archive_insert.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE RULE archive_insert AS ON INSERT TO archive -DO INSTEAD INSERT INTO archive2 VALUES ( - NEW.ar_namespace, NEW.ar_title, NEW.ar_text, NEW.ar_comment, NEW.ar_user, NEW.ar_user_text, - TO_TIMESTAMP(NEW.ar_timestamp, 'YYYYMMDDHH24MISS'), - NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id -); diff --git a/maintenance/postgres/archives/patch-ipb_address_unique.sql b/maintenance/postgres/archives/patch-ipb_address_unique.sql new file mode 100644 index 00000000..9cfc6318 --- /dev/null +++ b/maintenance/postgres/archives/patch-ipb_address_unique.sql @@ -0,0 +1,2 @@ +DROP INDEX IF EXISTS ipb_address; +CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only); diff --git a/maintenance/postgres/archives/patch-rev_text_id_idx.sql b/maintenance/postgres/archives/patch-rev_text_id_idx.sql deleted file mode 100644 index 036c0be3..00000000 --- a/maintenance/postgres/archives/patch-rev_text_id_idx.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE INDEX rev_text_id_idx ON revision (rev_text_id); diff --git a/maintenance/postgres/wp_mysql2postgres.pl b/maintenance/postgres/wp_mysql2postgres.pl deleted file mode 100644 index 981d99f3..00000000 --- a/maintenance/postgres/wp_mysql2postgres.pl +++ /dev/null @@ -1,400 +0,0 @@ -#!/usr/bin/perl - -## Convert data from a MySQL mediawiki database into a Postgres mediawiki database -## svn: $Id: wp_mysql2postgres.pl 18836 2007-01-05 03:37:19Z brion $ - -use strict; -use warnings; -use Data::Dumper; -use Getopt::Long; - -use vars qw(%table %tz %special @torder $COM); -my $VERSION = "1.0"; - -## The following options can be changed via command line arguments: -my $MYSQLDB = 'wikidb'; -my $MYSQLUSER = 'wikiuser'; - -## If the following are zero-length, we omit their arguments entirely: -my $MYSQLHOST = ''; -my $MYSQLPASSWORD = ''; -my $MYSQLSOCKET = ''; - -## Name of the dump file created -my $MYSQLDUMPFILE = "mediawiki_upgrade.pg"; - -## How verbose should this script be (0, 1, or 2) -my $verbose = 0; - -my $USAGE = " -Usage: $0 [OPTION]... -Convert a MediaWiki schema from MySQL to Postgres -Example: $0 --db=wikidb --user=wikiuser --pass=sushi -Options: - db Name of the MySQL database - user MySQL database username - pass MySQL database password - host MySQL database host - socket MySQL database socket - verbose Verbosity, increases with multiple uses -"; - -GetOptions - ( - "db=s" => \$MYSQLDB, - "user=s" => \$MYSQLUSER, - "pass=s" => \$MYSQLPASSWORD, - "host=s" => \$MYSQLHOST, - "socket=s" => \$MYSQLSOCKET, - "verbose+" => \$verbose - ); - -## The Postgres schema file: should not be changed -my $PG_SCHEMA = "tables.sql"; - -## What version we default to when we can't parse the old schema -my $MW_DEFAULT_VERSION = '1.8'; - -## Try and find a working version of mysqldump -$verbose and warn "Locating the mysqldump executable\n"; -my @MYSQLDUMP = ("/usr/local/bin/mysqldump", "/usr/bin/mysqldump"); -my $MYSQLDUMP; -for my $mytry (@MYSQLDUMP) { - next if ! -e $mytry; - -x $mytry or die qq{Not an executable file: "$mytry"\n}; - my $version = qx{$mytry -V}; - $version =~ /^mysqldump\s+Ver\s+\d+/ or die qq{Program at "$mytry" does not act like mysqldump\n}; - $MYSQLDUMP = $mytry; -} -$MYSQLDUMP or die qq{Could not find the mysqldump program\n}; - -## Flags we use for mysqldump -my @MYSQLDUMPARGS = qw( ---skip-lock-tables ---complete-insert ---skip-extended-insert ---skip-add-drop-table ---skip-add-locks ---skip-disable-keys ---skip-set-charset ---skip-comments ---skip-quote-names -); - - -$verbose and warn "Checking that mysqldump can handle our flags\n"; -## Make sure this version can handle all the flags we want. -## Combine with user dump below -my $MYSQLDUMPARGS = join " " => @MYSQLDUMPARGS; -## Argh. Any way to make this work on Win32? -my $version = qx{$MYSQLDUMP $MYSQLDUMPARGS 2>&1}; -if ($version =~ /unknown option/) { - die qq{Sorry, you need to use a newer version of the mysqldump program than the one at "$MYSQLDUMP"\n}; -} - -push @MYSQLDUMPARGS, "--user=$MYSQLUSER"; -length $MYSQLPASSWORD and push @MYSQLDUMPARGS, "--password=$MYSQLPASSWORD"; -length $MYSQLHOST and push @MYSQLDUMPARGS, "--host=$MYSQLHOST"; - -## Open the dump file to hold the mysqldump output -open my $mdump, "+>", $MYSQLDUMPFILE or die qq{Could not open "$MYSQLDUMPFILE": $!\n}; -$verbose and warn qq{Writing file "$MYSQLDUMPFILE"\n}; - -open my $mfork2, "-|" or exec $MYSQLDUMP, @MYSQLDUMPARGS, "--no-data", $MYSQLDB; -my $oldselect = select $mdump; - -print while <$mfork2>; - -## Slurp in the current schema -my $current_schema; -seek $mdump, 0, 0; -{ - local $/; - $current_schema = <$mdump>; -} -seek $mdump, 0, 0; -truncate $mdump, 0; - -warn qq{Trying to determine database version...\n} if $verbose; - -my $current_version = 0; -if ($current_schema =~ /CREATE TABLE \S+cur /) { - $current_version = '1.3'; -} -elsif ($current_schema =~ /CREATE TABLE \S+brokenlinks /) { - $current_version = '1.4'; -} -elsif ($current_schema !~ /CREATE TABLE \S+templatelinks /) { - $current_version = '1.5'; -} -elsif ($current_schema !~ /CREATE TABLE \S+validate /) { - $current_version = '1.6'; -} -elsif ($current_schema !~ /ipb_auto tinyint/) { - $current_version = '1.7'; -} -else { - $current_version = '1.8'; -} - -if (!$current_version) { - warn qq{WARNING! Could not figure out the old version, assuming MediaWiki $MW_DEFAULT_VERSION\n}; - $current_version = $MW_DEFAULT_VERSION; -} - -## Check for a table prefix: -my $table_prefix = ''; -if ($current_version =~ /CREATE TABLE (\S+)archive /) { - $table_prefix = $1; -} - -warn qq{Old schema is from MediaWiki version $current_version\n} if $verbose; -warn qq{Table prefix is "$table_prefix"\n} if $verbose and length $table_prefix; - -$verbose and warn qq{Writing file "$MYSQLDUMPFILE"\n}; -my $now = scalar localtime(); -my $conninfo = ''; -$MYSQLHOST and $conninfo .= "\n-- host $MYSQLHOST"; -$MYSQLSOCKET and $conninfo .= "\n-- socket $MYSQLSOCKET"; - -print qq{ --- Dump of MySQL Mediawiki tables for import into a Postgres Mediawiki schema --- Performed by the program: $0 --- Version: $VERSION (subversion }.q{$LastChangedRevision: 18836 $}.qq{) --- Author: Greg Sabino Mullane <greg\@turnstep.com> Comments welcome --- --- This file was created: $now --- Executable used: $MYSQLDUMP --- Connection information: --- database: $MYSQLDB --- user: $MYSQLUSER$conninfo - --- This file can be imported manually with psql like so: --- psql -p port# -h hostname -U username -f $MYSQLDUMPFILE databasename --- This will overwrite any existing MediaWiki information, so be careful - - -}; - -warn qq{Reading in the Postgres schema information\n} if $verbose; -open my $schema, "<", $PG_SCHEMA - or die qq{Could not open "$PG_SCHEMA": make sure this script is run from maintenance/postgres/\n}; -my $t; -while (<$schema>) { - if (/CREATE TABLE\s+(\S+)/) { - $t = $1; - $table{$t}={}; - } - elsif (/^ +(\w+)\s+TIMESTAMP/) { - $tz{$t}{$1}++; - } - elsif (/REFERENCES\s*([^( ]+)/) { - my $ref = $1; - exists $table{$ref} or die qq{No parent table $ref found for $t\n}; - $table{$t}{$ref}++; - } -} -close $schema; - -## Read in special cases and table/version information -$verbose and warn qq{Reading in schema exception information\n}; -my %version_tables; -while (<DATA>) { - if (/^VERSION\s+(\d+\.\d+):\s+(.+)/) { - my $list = join '|' => split /\s+/ => $2; - $version_tables{$1} = qr{\b$list\b}; - next; - } - next unless /^(\w+)\s*(.*)/; - $special{$1} = $2||''; - $special{$2} = $1 if length $2; -} - -## Determine the order of tables based on foreign key constraints -$verbose and warn qq{Figuring out order of tables to dump\n}; -my %dumped; -my $bail = 0; -{ - my $found=0; - T: for my $t (sort keys %table) { - next if exists $dumped{$t} and $dumped{$t} >= 1; - $found=1; - for my $dep (sort keys %{$table{$t}}) { - next T if ! exists $dumped{$dep} or $dumped{$dep} < 0; - } - $dumped{$t} = -1 if ! exists $dumped{$t}; - ## Skip certain tables that are not imported - next if exists $special{$t} and !$special{$t}; - push @torder, $special{$t} || $t; - } - last if !$found; - push @torder, "---"; - for (values %dumped) { $_+=2; } - die "Too many loops!\n" if $bail++ > 1000; - redo; -} - -## Prepare the Postgres database for the move -$verbose and warn qq{Writing Postgres transformation information\n}; - -print "\n-- Empty out all existing tables\n"; -$verbose and warn qq{Writing truncates to empty existing tables\n}; -for my $t (@torder) { - next if $t eq '---'; - my $tname = $special{$t}||$t; - printf qq{TRUNCATE TABLE %-18s CASCADE;\n}, qq{"$tname"}; -} -print "\n\n"; - -print qq{-- Rename the "text" table\n}; -print qq{ALTER TABLE pagecontent RENAME TO "text";\n\n}; - -print qq{-- Allow rc_ip to contain empty string, will convert at end\n}; -print qq{ALTER TABLE recentchanges ALTER rc_ip TYPE text USING host(rc_ip);\n\n}; - -print "-- Changing all timestamp fields to handle raw integers\n"; -for my $t (sort keys %tz) { - next if $t eq "archive2"; - for my $c (sort keys %{$tz{$t}}) { - printf "ALTER TABLE %-18s ALTER %-25s TYPE TEXT;\n", $t, $c; - } -} -print "\n"; - -print qq{ -INSERT INTO page VALUES (0,-1,'Dummy Page','',0,0,0,default,now(),0,10); -}; - -## If we have a table _prefix, we need to temporarily rename all of our Postgres -## tables temporarily for the import. Perhaps consider making this an auto-schema -## thing in the future. -if (length $table_prefix) { - print qq{\n\n-- Temporarily renaming tables to accomodate the table_prefix "$table_prefix"\n\n}; - for my $t (@torder) { - next if $t eq '---'; - my $tname = $special{$t}||$t; - printf qq{ALTER TABLE %-18s RENAME TO "${table_prefix}$tname"\n}, qq{"$tname"}; - } -} - - -## Try and dump the ill-named "user" table: -## We do this table alone because "user" is a reserved word. -print qq{ - -SET escape_string_warning TO 'off'; -\\o /dev/null - --- Postgres uses a table name of "mwuser" instead of "user" - --- Create a dummy user to satisfy fk contraints especially with revisions -SELECT setval('user_user_id_seq',0,'false'); -INSERT INTO mwuser - VALUES (DEFAULT,'Anonymous','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,now(),now()); - -}; - -push @MYSQLDUMPARGS, "--no-create-info"; - -$verbose and warn qq{Dumping "user" table\n}; -$verbose > 2 and warn Dumper \@MYSQLDUMPARGS; -my $usertable = "${table_prefix}user"; -open my $mfork, "-|" or exec $MYSQLDUMP, @MYSQLDUMPARGS, $MYSQLDB, $usertable; -## Unfortunately, there is no easy way to catch errors -my $numusers = 0; -while (<$mfork>) { - ++$numusers and print if s/INSERT INTO $usertable/INSERT INTO mwuser/; -} -close $mfork; -if ($numusers < 1) { - warn qq{No users found, probably a connection error.\n}; - print qq{ERROR: No users found, connection failed, or table "$usertable" does not exist. Dump aborted.\n}; - close $mdump; - exit; -} -print "\n-- Users loaded: $numusers\n\n-- Loading rest of the mediawiki schema:\n"; - -warn qq{Dumping all other tables from the MySQL schema\n} if $verbose; - -## Dump the rest of the tables, in chunks based on constraints -## We do not need the user table: -my @dumplist = grep { $_ ne 'user'} @torder; -my @alist; -{ - undef @alist; - PICKATABLE: { - my $tname = shift @dumplist; - ## XXX Make this dynamic below - for my $ver (sort {$b <=> $a } keys %version_tables) { - redo PICKATABLE if $tname =~ $version_tables{$ver}; - } - $tname = "${table_prefix}$tname" if length $table_prefix; - push @alist, $tname; - pop @alist and last if index($alist[-1],'---') >= 0; - redo if @dumplist; - } - - ## Dump everything else - open my $mfork2, "-|" or exec $MYSQLDUMP, @MYSQLDUMPARGS, $MYSQLDB, @alist; - print while <$mfork2>; - close $mfork2; - warn qq{Finished dumping from MySQL\n} if $verbose; - - redo if @dumplist; -} - -warn qq{Writing information to return Postgres database to normal\n} if $verbose; -print qq{ALTER TABLE "${table_prefix}text" RENAME TO pagecontent;\n}; -print qq{ALTER TABLE ${table_prefix}recentchanges ALTER rc_ip TYPE cidr USING\n}; -print qq{ CASE WHEN rc_ip = '' THEN NULL ELSE rc_ip::cidr END;\n}; - -## Return tables to their original names if a table prefix was used. -if (length $table_prefix) { - print qq{\n\n-- Renaming tables by removing table prefix "$table_prefix"\n\n}; - my $maxsize = 18; - for (@torder) { - $maxsize = length "$_$table_prefix" if length "$_$table_prefix" > $maxsize; - } - for my $t (@torder) { - next if $t eq '---' or $t eq 'text'; - my $tname = $special{$t}||$t; - printf qq{ALTER TABLE %*s RENAME TO "$tname"\n}, $maxsize+1, qq{"${table_prefix}$tname"}; - } -} - -print qq{\n\n--Returning timestamps to normal\n}; -for my $t (sort keys %tz) { - next if $t eq "archive2"; - for my $c (sort keys %{$tz{$t}}) { - printf "ALTER TABLE %-18s ALTER %-25s TYPE timestamptz\n". - " USING TO_TIMESTAMP($c,'YYYYMMDDHHMISS');\n", $t, $c; - } -} - -## Finally, make a record in the mediawiki_version table about this import -print qq{ -INSERT INTO mediawiki_version (type,mw_version,notes) VALUES ('MySQL import','??', -'Imported from file created on $now. Old version: $current_version'); -}; - - -print "\\o\n\n-- End of dump\n\n"; -select $oldselect; -close $mdump; -exit; - - -__DATA__ -## Known remappings: either indicate the MySQL name, -## or leave blank if it should be skipped -pagecontent text -mwuser user -mediawiki_version -archive2 -profiling -objectcache - -## Which tables to ignore depending on the version -VERSION 1.5: trackback -VERSION 1.6: externallinks job templatelinks transcache -VERSION 1.7: filearchive langlinks querycache_info diff --git a/maintenance/rebuildMessages.php b/maintenance/rebuildMessages.php deleted file mode 100644 index d009098d..00000000 --- a/maintenance/rebuildMessages.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * @todo document - * @package MediaWiki - * @subpackage Maintenance - */ - -/** */ -$options = array( 'update' => null, 'rebuild' => null ); -require_once( "commandLine.inc" ); -include_once( "InitialiseMessages.inc" ); - -$wgTitle = Title::newFromText( "Rebuild messages script" ); - -if ( isset( $args[0] ) ) { - # Retain script compatibility - $response = array_shift( $args ); - if ( $response == "update" ) { - $response = 1; - } elseif ( $response == "rebuild" ) { - $response = 2; - } -} else { - $response = 0; -} -if ( isset( $args[0] ) ) { - $messages = loadLanguageFile( array_shift( $args ) ); -} else { - $messages = false; -} -if( isset( $options['update'] ) ) $response = 1; -if( isset( $options['rebuild'] ) ) $response = 2; - -if ( $response == 0 ) { - $dbr =& wfGetDB( DB_SLAVE ); - $row = $dbr->selectRow( "page", array("count(*) as c"), array("page_namespace" => NS_MEDIAWIKI) ); - print "Current namespace size: {$row->c}\n"; - - print <<<END -Usage: php rebuildMessages.php <action> [filename] - -Action must be one of: - --update Update messages to include latest additions to MessagesXX.php - --rebuild Delete all messages and reinitialise namespace - -If a message dump file is given, messages will be read from it to supplement -the defaults in MediaWiki's Language*.php. The file should contain a serialized -PHP associative array, as produced by dumpMessages.php. - - -END; - exit(0); -} - -switch ( $response ) { - case 1: - initialiseMessages( false, $messages ); - break; - case 2: - initialiseMessages( true, $messages ); - break; -} - -exit(); - -?> diff --git a/maintenance/recount.sql b/maintenance/recount.sql deleted file mode 100644 index d9fec31f..00000000 --- a/maintenance/recount.sql +++ /dev/null @@ -1,8 +0,0 @@ --- --- Recalculate the article count --- - -SELECT @foo:=COUNT(*) FROM /*$wgDBprefix*/cur - WHERE cur_namespace=0 AND cur_is_redirect=0 AND cur_text like '%[[%'; -UPDATE /*$wgDBprefix*/site_stats SET ss_good_articles=@foo, ss_total_pages=-1, ss_users=-1, ss_admins=-1; - diff --git a/maintenance/redundanttrans.php b/maintenance/redundanttrans.php deleted file mode 100644 index de096863..00000000 --- a/maintenance/redundanttrans.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Prints out messages that are no longer used. - * - * @package MediaWiki - * @subpackage Maintenance - */ - -require_once('commandLine.inc'); - -if ( 'en' == $wgLanguageCode ) { - print "Current selected language is English. Cannot check translations.\n"; - exit(); -} - -$count = $total = 0; -$msgarray = 'wgAllMessages' . ucfirst( $wgLanguageCode ); - -foreach ( $$msgarray as $code => $msg ) { - ++$total; - if ( ! array_key_exists( $code, $wgAllMessagesEn ) ) { - print "* $code\n"; - ++$count; - } -} - -print "{$count} messages of {$total} are redundant\n"; -?> diff --git a/maintenance/splitLanguageFiles.inc b/maintenance/splitLanguageFiles.inc deleted file mode 100644 index c2500778..00000000 --- a/maintenance/splitLanguageFiles.inc +++ /dev/null @@ -1,1168 +0,0 @@ -<?php -/** - * This is an experimental list. It will later be used with a script to split - * the languages files in several parts then the message system will only load - * in memory the parts which are actually needed. - * - * Generated using: grep -r foobar * - * - * $commonMsg is the default array. Other arrays will only be loaded if needed. - */ -$installerMsg = array ( -'mainpagetext', -'mainpagedocfooter', -); - -$ActionMsg = array ( -'delete' => array( - 'delete', - 'deletethispage', - 'undelete_short1', - 'undelete_short', - 'undelete', - 'undeletepage', - 'undeletepagetext', - 'undeletearticle', - 'undeleterevisions', - 'undeletehistory', - 'undeleterevision', - 'undeletebtn', - 'undeletedarticle', - 'undeletedrevisions', - 'undeletedtext', - ), -'move' => array( - 'move', - 'movethispage', -), -'revert' => array( - -), -'protect' => array( - 'confirmprotect', - 'confirmprotecttext', - 'confirmunprotect', - 'confirmunprotecttext', - 'protect', - 'protectcomment', - 'protectmoveonly', - 'protectpage', - 'protectsub', - 'protectthispage', - 'unprotect', - 'unprotectthispage', - 'unprotectsub', - 'unprotectcomment', -), -); - -$CreditsMsg = array( -'anonymous', -'siteuser', -'lastmodifiedby', -'and', -'othercontribs', -'others', -'siteusers', -'creditspage', -'nocredits', -); - -// When showing differences -$DifferenceMsg = array( -'previousdiff', -'nextdiff', -); - -// used on page edition -$EditMsg = array( -'bold_sample', -'bold_tip', -'italic_sample', -'italic_tip', -'link_sample', -'link_tip', -'extlink_sample', -'extlink_tip', -'headline_sample', -'headline_tip', -'math_sample', -'math_tip', -'nowiki_sample', -'nowiki_tip', -'image_sample', -'image_tip', -'media_sample', -'media_tip', -'sig_tip', -'hr_tip', - -'accesskey-search', -'accesskey-minoredit', -'accesskey-save', -'accesskey-preview', -'accesskey-diff', -'accesskey-compareselectedversions', -'tooltip-search', -'tooltip-minoredit', -'tooltip-save', -'tooltip-preview', -'tooltip-diff', -'tooltip-compareselectedversions', -'tooltip-watch', - -'copyrightwarning', -'copyrightwarning2', -'editconflict', -'editing', -'editingcomment', -'editingold', -'editingsection', -'explainconflict', -'infobox', -'infobox_alert', -'longpagewarning', -'nonunicodebrowser', -'previewconflict', -'previewnote', -'protectedpagewarning', -'readonlywarning', -'spamprotectiontitle', -'spamprotectiontext', -'spamprotectionmatch', -'templatesused', -'yourdiff', -'yourtext', -); - -// Per namespace -$NamespaceCategory = array ( -'category_header', -'categoryarticlecount', -'categoryarticlecount1', -'listingcontinuesabbrev', -'subcategories', -'subcategorycount', -'subcategorycount1', -'usenewcategorypage', -); - -$NamespaceImage = array ( -'deletedrevision', -'edit-externally', -'edit-externally-help', -'showbigimage', -); - -$NamespaceSpecialMsg = array( -'nosuchspecialpage', -'nospecialpagetext', -); - - - -// per special pages -$SpecialAllMessages = array( -'allmessages', -'allmessagesname', -'allmessagesdefault', -'allmessagescurrent', -'allmessagestext', -'allmessagesnotsupportedUI', -'allmessagesnotsupportedDB', -); - - -$SpecialAllPages = array( -'articlenamespace', -'allpagesformtext1', -'allpagesformtext2', -'allarticles', -'allpagesprev', -'allpagesnext', -'allpagesnamespace', -'allpagessubmit', -); - - -$SpecialAskSQLMsg = array( -'asksql', -'asksqltext', -'sqlislogged', -'sqlquery', -'querybtn', -'selectonly', -'querysuccessful', -); - -$SpecialBlockip = array( -'blockip', -'blockiptext', -'range_block_disabled', -'ipb_expiry_invalid', -'ip_range_invalid', -'ipbexpiry', -'ipbsubmit', -); - -$SpecialContributions = array( -'contribsub', -'contributionsall', -'newbies', -'nocontribs', -'ucnote', -'uclinks', -'uctop', -); - -$SpecialExportMsg = array ( -'export', -'exporttext', -'exportcuronly', -); - -$SpecialImagelist = array( -'imagelistall', -); - -$SpecialImportMsg = array ( -'import', -'importtext', -'importfailed', -'importnotext', -'importsuccess', -'importhistoryconflict', -); - -$SpecialLockdbMsg = array( -'lockdb', -'unlockdb', -'lockdbtext', -'unlockdbtext', -'lockconfirm', -'unlockconfirm', -'lockbtn', -'unlockbtn', -'locknoconfirm', -'lockdbsuccesssub', -'unlockdbsuccesssub', -'lockdbsuccesstext', -'unlockdbsuccesstext', -); - -$SpecialLogMsg = array( -'specialloguserlabel', -'speciallogtitlelabel', -); - -$SpecialMaintenance = array( -'maintenance', -'maintnancepagetext', -'maintenancebacklink', -'disambiguations', -'disambiguationspage', -'disambiguationstext', -'doubleredirects', -'doubleredirectstext', -'brokenredirects', -'brokenredirectstext', -'selflinks', -'selflinkstext', -'mispeelings', -'mispeelingstext', -'mispeelingspage', -'missinglanguagelinks', -'missinglanguagelinksbutton', -'missinglanguagelinkstext', -); - -$SpecialMakeSysopMsg = array ( -'already_bureaucrat', -'already_sysop', -'makesysop', -'makesysoptitle', -'makesysoptext', -'makesysopname', -'makesysopsubmit', -'makesysopok', -'makesysopfail', -'rights', -'set_rights_fail', -'set_user_rights', -'user_rights_set', -); - -$SpecialMovepageMsg = array( -'newtitle', -'movearticle', -'movenologin', -'movenologintext', -'movepage', -'movepagebtn', -'movepagetalktext', -'movepagetext', -'movetalk', -'pagemovedsub', -'pagemovedtext', -'talkexists', -'talkpagemoved', -'talkpagenotmoved', - -); - -$SpecialPreferencesMsg = array( -'tog-underline', -'tog-highlightbroken', -'tog-justify', -'tog-hideminor', -'tog-usenewrc', -'tog-numberheadings', -'tog-showtoolbar', -'tog-editondblclick', -'tog-editsection', -'tog-editsectiononrightclick', -'tog-showtoc', -'tog-rememberpassword', -'tog-editwidth', -'tog-watchdefault', -'tog-minordefault', -'tog-previewontop', -'tog-previewonfirst', -'tog-nocache', -'tog-enotifwatchlistpages', -'tog-enotifusertalkpages', -'tog-enotifminoredits', -'tog-enotifrevealaddr', -'tog-shownumberswatching', -'tog-rcusemodstyle', -'tog-showupdated', -'tog-fancysig', -'tog-externaleditor', - -'imagemaxsize', -'prefs-help-email', -'prefs-help-email-enotif', -'prefs-help-realname', -'prefs-help-userdata', -'prefs-misc', -'prefs-personal', -'prefs-rc', -'resetprefs', -'saveprefs', -'oldpassword', -'newpassword', -'retypenew', -'textboxsize', -'rows', -'columns', -'searchresultshead', -'resultsperpage', -'contextlines', -'contextchars', -'stubthreshold', -'recentchangescount', -'savedprefs', -'timezonelegend', -'timezonetext', -'localtime', -'timezoneoffset', -'servertime', -'guesstimezone', -'emailflag', -'defaultns', -'default', -); - -$SpecialRecentchangesMsg = array( -'changes', -'recentchanges', -'recentchanges-url', -'recentchangestext', -'rcloaderr', -'rcnote', -'rcnotefrom', -'rclistfrom', -'showhideminor', -'rclinks', -'rchide', -'rcliu', -'diff', -'hist', -'hide', -'show', -'tableform', -'listform', -'nchanges', -'minoreditletter', -'newpageletter', -'sectionlink', -'number_of_watching_users_RCview', -'number_of_watching_users_pageview', -'recentchangesall', -); - -$SpecialRecentchangeslinkedMsg = array( -'rclsub', -); - -$SpecialSearchMsg = array( -'searchresults', -'searchresulttext', -'searchquery', -'badquery', -'badquerytext', -'matchtotals', -'nogomatch', -'titlematches', -'notitlematches', -'textmatches', -'notextmatches', -); - -$SpecialSitesettingsMsg = array( -'sitesettings', -'sitesettings-features', -'sitesettings-permissions', -'sitesettings-memcached', -'sitesettings-debugging', -'sitesettings-caching', -'sitesettings-wgShowIPinHeader', -'sitesettings-wgUseDatabaseMessages', -'sitesettings-wgUseCategoryMagic', -'sitesettings-wgUseCategoryBrowser', -'sitesettings-wgHitcounterUpdateFreq', -'sitesettings-wgAllowExternalImages', -'sitesettings-permissions-readonly', -'sitesettings-permissions-whitelist', -'sitesettings-permissions-banning', -'sitesettings-permissions-miser', -'sitesettings-wgReadOnly', -'sitesettings-wgReadOnlyFile', -'sitesettings-wgWhitelistEdit', -'sitesettings-wgWhitelistRead', -'sitesettings-wgWhitelistAccount-user', -'sitesettings-wgWhitelistAccount-sysop', -'sitesettings-wgWhitelistAccount-developer', -'sitesettings-wgSysopUserBans', -'sitesettings-wgSysopRangeBans', -'sitesettings-wgDefaultBlockExpiry', -'sitesettings-wgMiserMode', -'sitesettings-wgDisableQueryPages', -'sitesettings-wgUseWatchlistCache', -'sitesettings-wgWLCacheTimeout', -'sitesettings-cookies', -'sitesettings-performance', -'sitesettings-images', -); - -$SpecialStatisticsMsg = array( -'statistics', -'sitestats', -'userstats', -'sitestatstext', -'userstatstext', -); - -$SpecialUndelte = array( -'deletepage', -); - -$SpecialUploadMsg = array( -'affirmation', -'badfilename', -'badfiletype', -'emptyfile', -'fileexists', -'filedesc', -'filename', -'filesource', -'filestatus', -'fileuploaded', -'ignorewarning', -'illegalfilename', -'largefile', -'minlength', -'noaffirmation', -'reupload', -'reuploaddesc', -'savefile', -'successfulupload', -'upload', -'uploadbtn', -'uploadcorrupt', -'uploaddisabled', -'uploadfile', -'uploadedimage', -'uploaderror', -'uploadlink', -'uploadlog', -'uploadlogpage', -'uploadlogpagetext', -'uploadnologin', -'uploadnologintext', -'uploadtext', -'uploadwarning', -); - -$SpecialUserlevelsMsg = array( -'saveusergroups', -'userlevels-editusergroup', -'userlevels-groupsavailable', -'userlevels-groupshelp', -'userlevels-groupsmember', -); - -$SpecialUserloginMsg = array( -'acct_creation_throttle_hit', -'loginend', -'loginsuccesstitle', -'loginsuccess', -'nocookiesnew', -'nocookieslogin', -'noemail', -'noname', -'nosuchuser', -'mailmypassword', -'mailmypasswordauthent', -'passwordremindermailsubject', -'passwordremindermailbody', -'passwordsent', -'passwordsentforemailauthentication', -'userexists', -'wrongpassword', -); - -$SpecialValidateMsg = array( -'val_yes', -'val_no', -'val_revision', -'val_time', -'val_list_header', -'val_add', -'val_del', -'val_warning', -'val_rev_for', -'val_rev_stats_link', -'val_iamsure', -'val_clear_old', -'val_merge_old', -'val_form_note', -'val_noop', -'val_percent', -'val_percent_single', -'val_total', -'val_version', -'val_tab', -'val_this_is_current_version', -'val_version_of', -'val_table_header', -'val_stat_link_text', -'val_view_version', -'val_validate_version', -'val_user_validations', -'val_no_anon_validation', -'val_validate_article_namespace_only', -'val_validated', -'val_article_lists', -'val_page_validation_statistics', -); - -$SpecialVersionMsg = array( -'special_version_prefix', -'special_version_postfix' -); - -$SpecialWatchlistMsg = array( -'watchlistall1', -'watchlistall2', -'wlnote', -'wlshowlast', -'wlsaved', -'wlhideshowown', -'wlshow', -'wlhide', -); - -$SpecialWhatlinkshereMsg = array( -'linklistsub', -'nolinkshere', -'isredirect', -); - - -$commonMsg = array ( -'sunday', -'monday', -'tuesday', -'wednesday', -'thursday', -'friday', -'saturday', -'january', -'february', -'march', -'april', -'may_long', -'june', -'july', -'august', -'september', -'october', -'november', -'december', -'jan', -'feb', -'mar', -'apr', -'may', -'jun', -'jul', -'aug', -'sep', -'oct', -'nov', -'dec', -'categories', -'category', -'linktrail', -'mainpage', -'portal', -'portal-url', -'about', -'aboutsite', -'aboutpage', -'article', -'help', -'helppage', -'wikititlesuffix', -'bugreports', -'bugreportspage', -'sitesupport', -'sitesupport-url', -'faq', -'faqpage', -'edithelp', -'newwindow', -'edithelppage', -'cancel', -'qbfind', -'qbbrowse', -'qbedit', -'qbpageoptions', -'qbpageinfo', -'qbmyoptions', -'qbspecialpages', -'moredotdotdot', -'mypage', -'mytalk', -'anontalk', -'navigation', -'metadata', -'metadata_page', -'currentevents', -'currentevents-url', -'disclaimers', -'disclaimerpage', -'errorpagetitle', -'returnto', -'tagline', -'whatlinkshere', -'search', -'go', -'history', -'history_short', -'info_short', -'printableversion', -'edit', -'editthispage', -'newpage', -'talkpage', -'specialpage', -'personaltools', -'postcomment', -'addsection', -'articlepage', -'subjectpage', -'talk', -'toolbox', -'userpage', -'wikipediapage', -'imagepage', -'viewtalkpage', -'otherlanguages', -'redirectedfrom', -'lastmodified', -'viewcount', -'copyright', -'poweredby', -'printsubtitle', -'protectedpage', -'administrators', -'sysoptitle', -'sysoptext', -'developertitle', -'developertext', -'bureaucrattitle', -'bureaucrattext', -'nbytes', -'ok', -'sitetitle', -'pagetitle', -'sitesubtitle', -'retrievedfrom', -'newmessages', -'newmessageslink', -'editsection', -'toc', -'showtoc', -'hidetoc', -'thisisdeleted', -'restorelink', -'feedlinks', -'sitenotice', -'nstab-main', -'nstab-user', -'nstab-media', -'nstab-special', -'nstab-wp', -'nstab-image', -'nstab-mediawiki', -'nstab-template', -'nstab-help', -'nstab-category', -'nosuchaction', -'nosuchactiontext', - - -'error', -'databaseerror', -'dberrortext', -'dberrortextcl', -'noconnect', -'nodb', -'cachederror', -'laggedslavemode', -'readonly', -'enterlockreason', -'readonlytext', -'missingarticle', -'internalerror', -'filecopyerror', -'filerenameerror', -'filedeleteerror', -'filenotfound', -'unexpected', -'formerror', -'badarticleerror', -'cannotdelete', -'badtitle', -'badtitletext', -'perfdisabled', -'perfdisabledsub', -'perfcached', -'wrong_wfQuery_params', -'viewsource', -'protectedtext', -'seriousxhtmlerrors', -'logouttitle', -'logouttext', -'welcomecreation', - -'loginpagetitle', -'yourname', -'yourpassword', -'yourpasswordagain', -'newusersonly', -'remembermypassword', -'loginproblem', -'alreadyloggedin', -'login', -'loginprompt', -'userlogin', -'logout', -'userlogout', -'notloggedin', -'createaccount', -'createaccountmail', -'badretype', - -'youremail', -'yourrealname', -'yourlanguage', -'yourvariant', -'yournick', -'emailforlost', -'loginerror', -'nosuchusershort', - -'mailerror', -'emailauthenticated', -'emailnotauthenticated', -'invalidemailaddress', -'disableduntilauthent', -'disablednoemail', - -'summary', -'subject', -'minoredit', -'watchthis', -'savearticle', -'preview', -'showpreview', -'showdiff', -'blockedtitle', -'blockedtext', -'whitelistedittitle', -'whitelistedittext', -'whitelistreadtitle', -'whitelistreadtext', -'whitelistacctitle', -'whitelistacctext', -'loginreqtitle', -'loginreqtext', -'accmailtitle', -'accmailtext', -'newarticle', -'newarticletext', -'talkpagetext', -'anontalkpagetext', -'noarticletext', -'clearyourcache', -'usercssjsyoucanpreview', -'usercsspreview', -'userjspreview', -'updated', -'note', -'storedversion', // not used ? Editpage ? -'revhistory', -'nohistory', -'revnotfound', -'revnotfoundtext', -'loadhist', -'currentrev', -'revisionasof', -'revisionasofwithlink', -'previousrevision', -'nextrevision', -'currentrevisionlink', -'cur', -'next', -'last', -'orig', -'histlegend', -'history_copyright', -'difference', -'loadingrev', -'lineno', -'editcurrent', -'selectnewerversionfordiff', -'selectolderversionfordiff', -'compareselectedversions', - -'prevn', -'nextn', -'viewprevnext', -'showingresults', -'showingresultsnum', -'nonefound', -'powersearch', -'powersearchtext', -'searchdisabled', -'googlesearch', -'blanknamespace', -'preferences', -'prefsnologin', -'prefsnologintext', -'prefslogintext', -'prefsreset', -'qbsettings', -'qbsettingsnote', -'changepassword', -'skin', -'math', -'dateformat', - -'math_failure', -'math_unknown_error', -'math_unknown_function', -'math_lexing_error', -'math_syntax_error', -'math_image_error', -'math_bad_tmpdir', -'math_bad_output', -'math_notexvc', - - - - - - -'grouplevels-lookup-group', -'grouplevels-group-edit', -'editgroup', -'addgroup', -'userlevels-lookup-user', -'userlevels-user-editname', -'editusergroup', -'grouplevels-editgroup', -'grouplevels-addgroup', -'grouplevels-editgroup-name', -'grouplevels-editgroup-description', -'savegroup', - -// common to several pages -'copyrightpage', -'copyrightpagename', -'imagelist', -'imagelisttext', -'ilshowmatch', -'ilsubmit', -'showlast', -'byname', -'bydate', -'bysize', - - - -'imgdelete', -'imgdesc', -'imglegend', -'imghistory', -'revertimg', -'deleteimg', -'deleteimgcompletely', -'imghistlegend', -'imagelinks', -'linkstoimage', -'nolinkstoimage', - -// unused ?? -'uploadedfiles', -'getimagelist', - - -'sharedupload', -'shareduploadwiki', - -// Special pages names -'orphans', -'geo', -'validate', -'lonelypages', -'uncategorizedpages', -'uncategorizedcategories', -'unusedimages', -'popularpages', -'nviews', -'wantedpages', -'nlinks', -'allpages', -'randompage', -'randompage-url', -'shortpages', -'longpages', -'deadendpages', -'listusers', -'specialpages', -'spheading', -'restrictedpheading', -'recentchangeslinked', - - -'debug', -'newpages', -'ancientpages', -'intl', -'unusedimagestext', -'booksources', -'categoriespagetext', -'data', -'userlevels', -'grouplevels', -'booksourcetext', -'isbn', -'rfcurl', -'pubmedurl', -'alphaindexline', -'version', -'log', -'alllogstext', -'nextpage', -'mailnologin', -'mailnologintext', -'emailuser', -'emailpage', -'emailpagetext', -'usermailererror', -'defemailsubject', -'noemailtitle', -'noemailtext', -'emailfrom', -'emailto', -'emailsubject', -'emailmessage', -'emailsend', -'emailsent', -'emailsenttext', -'watchlist', -'watchlistsub', -'nowatchlist', -'watchnologin', -'watchnologintext', -'addedwatch', -'addedwatchtext', -'removedwatch', -'removedwatchtext', -'watch', -'watchthispage', -'unwatch', -'unwatchthispage', -'notanarticle', -'watchnochange', -'watchdetails', -'watchmethod-recent', -'watchmethod-list', -'removechecked', -'watchlistcontains', -'watcheditlist', -'removingchecked', -'couldntremove', -'iteminvalidname', - -'updatedmarker', -'email_notification_mailer', -'email_notification_infotext', -'email_notification_reset', -'email_notification_newpagetext', -'email_notification_to', -'email_notification_subject', -'email_notification_lastvisitedrevisiontext', -'email_notification_body', - -'confirm', -'excontent', -'exbeforeblank', -'exblank', -'confirmdelete', -'deletesub', -'historywarning', -'confirmdeletetext', -'actioncomplete', -'deletedtext', -'deletedarticle', -'dellogpage', -'dellogpagetext', -'deletionlog', -'reverted', -'deletecomment', -'imagereverted', -'rollback', -'rollback_short', -'rollbacklink', -'rollbackfailed', -'cantrollback', -'alreadyrolled', -'revertpage', -'editcomment', -'sessionfailure', - -'protectlogpage', -'protectlogtext', - -'protectedarticle', -'unprotectedarticle', - -'contributions', -'mycontris', -'notargettitle', // not used ? -'notargettext', // not used ? - -'linkshere', - -'ipaddress', -'ipadressorusername', // not used ? -'ipbreason', - -'badipaddress', -'noblockreason', -'blockipsuccesssub', -'blockipsuccesstext', -'unblockip', -'unblockiptext', -'ipusubmit', -'ipusuccess', -'ipblocklist', -'blocklistline', -'blocklink', -'unblocklink', -'contribslink', -'autoblocker', -'blocklogpage', -'blocklogentry', -'blocklogtext', -'unblocklogentry', // not used ? - -'proxyblocker', -'proxyblockreason', -'proxyblocksuccess', -'sorbs', -'sorbsreason', - -'setbureaucratflag', -'bureaucratlog', -'rightslogtext', -'bureaucratlogentry', - -'articleexists', // not used ? - -'movedto', -'1movedto2', -'1movedto2_redir', -'movelogpage', -'movelogpagetext', - -'thumbnail-more', -'missingimage', -'filemissing', -'Monobook.css', -'nodublincore', -'nocreativecommons', -'notacceptable', - -// used in Article:: -'infosubtitle', -'numedits', -'numtalkedits', -'numwatchers', -'numauthors', -'numtalkauthors', - -// not used ? -'mw_math_png', -'mw_math_simple', -'mw_math_html', -'mw_math_source', -'mw_math_modern', -'mw_math_mathml', - -// Patrolling -'markaspatrolleddiff', -'markaspatrolledlink', -'markaspatrolledtext', -'markedaspatrolled', -'markedaspatrolledtext', -'rcpatroldisabled', // not used ? -'rcpatroldisabledtext', // not used ? - -'Monobook.js', -'newimages', -'noimages', -'variantname-zh-cn', -'variantname-zh-tw', -'variantname-zh-hk', -'variantname-zh-sg', -'variantname-zh', -'zhconversiontable', -'passwordtooshort', // sp preferences / userlogin -); -?> diff --git a/maintenance/splitLanguageFiles.php b/maintenance/splitLanguageFiles.php deleted file mode 100644 index b80f38fc..00000000 --- a/maintenance/splitLanguageFiles.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * splitLanguageFiles - * Should read each of the languages files then split them in several subpart - * under ./languages/XX/ according to the arrays in splitLanguageFiles.inc . - * - * Also need to rewrite the wfMsg system / message-cache. - */ - -include('commandLine.inc'); - - -?> diff --git a/maintenance/transstat.php b/maintenance/transstat.php deleted file mode 100644 index e54a668c..00000000 --- a/maintenance/transstat.php +++ /dev/null @@ -1,203 +0,0 @@ -<?php -/** - * @package MediaWiki - * @subpackage Maintenance - * - * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> - * @author Ashar Voultoiz <thoane@altern.org> - * @bug 2499 - * - * Output is posted from time to time on: - * http://meta.wikimedia.org/wiki/Localization_statistics - */ - -/** */ -require_once('commandLine.inc'); -require_once('languages.inc'); - -if( isset($options['help']) ) { usage(); wfDie(); } -// default output is WikiText -if( !isset($options['output']) ) { $options['output']='wiki'; } - - -/** Print a usage message*/ -function usage() { -print <<<END -Usage: php transstat.php [--help] [--output:csv|text|wiki] [--showdupes] - --help : this helpful message - --showold : show old messages that are not in Messages.php - --output : select an output engine one of: - * 'csv' : Comma Separated Values. - * 'none' : Nothing, usefull with --showdupes - * 'wiki' : MediaWiki syntax (default). - * 'text' : Text with tabs. -Example: php transstat.php --showdupes --output=none - - -END; -} - - -/** A general output object. Need to be overriden */ -class statsOutput { - var $output; // buffer that contain the text - function statsOutput() { $this->output='';} - function getContent() { return $this->output;} - - function formatPercent($subset, $total, $revert=false, $accuracy=2) { - return @sprintf( '%.' . $accuracy . 'f%%', 100 * $subset / $total ); - } - - // Override the next methods - function heading() {} - function footer() {} - function blockstart() {} - function blockend() {} - function element($in, $heading=false) {} -} - -/** Outputs nothing ! */ -class noneStatsOutput extends statsOutput { - function getContent() { return NULL;} -} - -/** Outputs WikiText */ -class wikiStatsOutput extends statsOutput { - function heading() { - $this->output .= "{| border=2 cellpadding=4 cellspacing=0 style=\"background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;\" width=100%\n"; - } - function footer() { $this->output .= "|}\n"; } - function blockstart() { $this->output .= "|-\n"; } - function blockend() { $this->output .= ''; } - function element($in, $heading = false) { - $this->output .= ($heading ? '!' : '|') . " $in\n"; - } - function formatPercent($subset, $total, $revert=false, $accuracy=2) { - $v = @round(255 * $subset / $total); - if($revert) $v = 255 - $v; - if($v < 128) { - // red to yellow - $red = 'FF'; - $green = sprintf('%02X', 2*$v); - } else { - // yellow to green - $red = sprintf('%02X', 2*(255 -$v) ); - $green = 'FF'; - } - $blue = '00'; - $color = $red.$green.$blue; - - $percent = statsOutput::formatPercent($subset, $total, $revert, $accuracy); - return 'bgcolor="#'.$color.'" | '.$percent; - } -} - -/** Output text. To be used on a terminal for example. */ -class textStatsOutput extends statsOutput { - function element($in, $heading = false) { - $this->output .= $in."\t"; - } - function blockend(){ $this->output .="\n";} -} - -/** csv output. Some people love excel */ -class csvStatsOutput extends statsOutput { - function element($in, $heading = false) { - $this->output .= $in.";"; - } - function blockend(){ $this->output .="\n";} -} - - -function redundant(&$arr, $langcode) { - global $wgAllMessagesEn; - - $redundant = 0; - foreach(array_keys($arr) as $key) { - if ( @$wgAllMessagesEn[$key] === null ) { - global $options; - if( isset($options['showold']) ) { - print "Deprecated [$langcode]: $key\n"; - } - ++$redundant; - } - } - return $redundant; -} - -// Select an output engine -switch ($options['output']) { - case 'csv': - $out = new csvStatsOutput(); break; - case 'none': - $out = new noneStatsOutput(); break; - case 'text': - $out = new textStatsOutput(); break; - case 'wiki': - $out = new wikiStatsOutput(); break; - default: - usage(); wfDie(); - break; -} - -$langTool = new languages(); - -// Load message and compute stuff -$msgs = array(); -foreach($langTool->getList() as $langcode) { - // Since they aren't loaded by default.. - require_once( 'languages/Language' . $langcode . '.php' ); - $arr = 'wgAllMessages'.$langcode; - if(@is_array($$arr)) { - $msgs[$wgContLang->lcfirst($langcode)] = array( - 'total' => count($$arr), - 'redundant' => redundant($$arr, $langcode), - ); - } else { - $msgs[$wgContLang->lcfirst($langcode)] = array( - 'total' => 0, - 'redundant' => 0, - ); - } -} - -// Top entry -$out->heading(); -$out->blockstart(); -$out->element('Language', true); -$out->element('Translated', true); -$out->element('%', true); -$out->element('Untranslated', true); -$out->element('%', true); -$out->element('Redundant', true); -$out->element('%', true); -$out->blockend(); - -// Generate rows -foreach($msgs as $lang => $stats) { - $out->blockstart(); - // Language - $out->element($wgContLang->getLanguageName(strtr($lang, '_', '-')) . " ($lang)"); - // Translated - $out->element($stats['total'] . '/' . $msgs['en']['total']); - // % Translated - $out->element($out->formatPercent($stats['total'], $msgs['en']['total'])); - // Untranslated - $out->element($msgs['en']['total'] - $stats['total']); - // % Untranslated - $out->element($out->formatPercent($msgs['en']['total'] - $stats['total'], $msgs['en']['total'], true)); - // Redundant & % Redundant - if($stats['redundant'] =='NC') { - $out->element('NC'); - $out->element('NC'); - } else { - $out->element($stats['redundant'] . '/' . $stats['total']); - $out->element($out->formatPercent($stats['redundant'], $stats['total'],true)); - } - $out->blockend(); -} -$out->footer(); - -// Final output -echo $out->getContent(); -?> diff --git a/maintenance/trivialCmdLine.php b/maintenance/trivialCmdLine.php deleted file mode 100644 index 2f12815f..00000000 --- a/maintenance/trivialCmdLine.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php -/** - * @package MediaWiki - * @subpackage Maintenance - */ - -/** */ -require_once( "commandLine.inc" ); -# print "DB name: $wgDBname\n"; -# print "DB user: $wgDBuser\n"; -# print "DB password: $wgDBpassword\n"; - -print "This is an example command-line maintenance script.\n"; - -$dbr =& wfGetDB( DB_SLAVE ); -$page = $dbr->tableName( 'page' ); -$res = $dbr->query( "SELECT MAX(page_id) as m FROM $page" ); -$row = $dbr->fetchObject( $res ); -print "Max page_id: {$row->m}\n"; - -?> diff --git a/maintenance/userDupes.php b/maintenance/userDupes.php deleted file mode 100644 index 90de160d..00000000 --- a/maintenance/userDupes.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -# Copyright (C) 2005 Brion Vibber <brion@pobox.com> -# http://www.mediawiki.org/ -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# http://www.gnu.org/copyleft/gpl.html - -$options = array( 'fix' ); - -/** */ -require_once( 'commandLine.inc' ); -require_once( 'maintenance/userDupes.inc' ); - -$wgTitle = Title::newFromText( 'Dupe user entry cleanup script' ); - -$fix = isset( $options['fix'] ); -$dbw = wfGetDB( DB_MASTER ); -$duper = new UserDupes( $dbw ); -$retval = $duper->checkDupes( $fix ); - -if( $retval ) { - echo "\nLooks good!\n"; - exit( 0 ); -} else { - echo "\nOh noeees\n"; - exit( -1 ); -} - -?>
\ No newline at end of file diff --git a/maintenance/wiki-mangleme.php b/maintenance/wiki-mangleme.php deleted file mode 100644 index 6b180257..00000000 --- a/maintenance/wiki-mangleme.php +++ /dev/null @@ -1,553 +0,0 @@ -<?php -/** - -Author : Nick Jenkins, http://nickj.org/ -Date : 18 May 2006. -License: GPL v 2. - -Desc: - Performs fuzz-style testing of MediaWiki's parser. - The script feeds the parser some randomized malformed wiki-text, and stores - the HTML output. - - Checks the HTML output for: - - unclosed tags - - errors in Tidy - both can indicate potential security issues. - - Can optionally W3C validate of the HTML output (indicates malformed HTML - output). - -Background: - Contains a PHP port, of a "shameless" Python PORT, OF LCAMTUF'S MANGELME - http://www.securiteam.com/tools/6Z00N1PBFK.html - -Requirements: - You need PHP4 or PHP5, with PHP-curl enabled, and Tidy installed. - -Usage: - Update the "Configuration" section, especially the "WIKI_URL" to point - to a local wiki you can test stuff on. You can optionally set - "VALIDATE_ON_WEB" to true, although at the moment very few generated pages - will validate. Then run "php wiki-mangleme.php". - - This will print a list of HTML output that had unclosed tags, and/or that - caused tidy errors. It will keep running until you press Ctrl-C. All output - files are stored in the "mangleme" subdirectory. -*/ - -# This is a command line script, load mediawiki env: -include('commandLine.inc'); - -// Configuration: - -# The directory name where we store the output -# for windows: "c:\\temp\\mangleme" -define("DIRECTORY", "/tmp/mangleme"); - -# URL to some wiki on which we can run our tests: -define("WIKI_URL", $wgServer . $wgScriptPath . '/index.php?title=WIKIMANGLE' ); - -# Should our test output include binary strings? -define("INCLUDE_BINARY", false); - -# Whether we want to send output on the web for validation: -define("VALIDATE_ON_WEB", false); -# URL to use to validate our output: -define("VALIDATOR_URL", "http://validator.w3.org/check"); - - -// If it goes wrong, we want to know about it. -error_reporting(E_ALL); - -///////////////////// DEFINE THE DATA THAT WILL BE USED ////////////////////// -/* Note: Only some HTML tags are understood by MediaWiki, the rest is ignored. - The tags that are ignored have been commented out below. */ - -$data = array(); -// $data["A"] = array("NAME", "HREF", "REF", "REV", "TITLE", "TARGET", "SHAPE", "onLoad", "STYLE"); -// $data["APPLET"] = array("CODEBASE", "CODE", "NAME", "ALIGN", "ALT", "HEIGHT", "WIDTH", "HSPACE", "VSPACE", "DOWNLOAD", "HEIGHT", "NAME", "TITLE", "onLoad", "STYLE"); -// $data["AREA"] = array("SHAPE", "ALT", "CO-ORDS", "HREF", "onLoad", "STYLE"); -$data["B"] = array("onLoad", "STYLE"); -// $data["BANNER"] = array("onLoad", "STYLE"); -// $data["BASE"] = array("HREF", "TARGET", "onLoad", "STYLE"); -// $data["BASEFONT"] = array("SIZE", "onLoad", "STYLE"); -// $data["BGSOUND"] = array("SRC", "LOOP", "onLoad", "STYLE"); -// $data["BQ"] = array("CLEAR", "NOWRAP", "onLoad", "STYLE"); -// $data["BODY"] = array("BACKGROUND", "BGCOLOR", "TEXT", "LINK", "ALINK", "VLINK", "LEFTMARGIN", "TOPMARGIN", "BGPROPERTIES", "onLoad", "STYLE"); -$data["CAPTION"] = array("ALIGN", "VALIGN", "onLoad", "STYLE"); -$data["CENTER"] = array("onLoad", "STYLE"); -// $data["COL"] = array("ALIGN", "SPAN", "onLoad", "STYLE"); -// $data["COLGROUP"] = array("ALIGN", "VALIGN", "HALIGN", "WIDTH", "SPAN", "onLoad", "STYLE"); -$data["DIV"] = array("ALIGN", "CLASS", "LANG", "onLoad", "STYLE"); -// $data["EMBED"] = array("SRC", "HEIGHT", "WIDTH", "UNITS", "NAME", "PALETTE", "onLoad", "STYLE"); -// $data["FIG"] = array("SRC", "ALIGN", "HEIGHT", "WIDTH", "UNITS", "IMAGEMAP", "onLoad", "STYLE"); -// $data["FN"] = array("ID", "onLoad", "STYLE"); -$data["FONT"] = array("SIZE", "COLOR", "FACE", "onLoad", "STYLE"); -// $data["FORM"] = array("ACTION", "METHOD", "ENCTYPE", "TARGET", "SCRIPT", "onLoad", "STYLE"); -// $data["FRAME"] = array("SRC", "NAME", "MARGINWIDTH", "MARGINHEIGHT", "SCROLLING", "FRAMESPACING", "onLoad", "STYLE"); -// $data["FRAMESET"] = array("ROWS", "COLS", "onLoad", "STYLE"); -$data["H1"] = array("SRC", "DINGBAT", "onLoad", "STYLE"); -// $data["HEAD"] = array("onLoad", "STYLE"); -$data["HR"] = array("SRC", "SIZE", "WIDTH", "ALIGN", "COLOR", "onLoad", "STYLE"); -// $data["HTML"] = array("onLoad", "STYLE"); -// $data["IFRAME"] = array("ALIGN", "FRAMEBORDER", "HEIGHT", "MARGINHEIGHT", "MARGINWIDTH", "NAME", "SCROLLING", "SRC", "ADDRESS", "WIDTH", "onLoad", "STYLE"); -// $data["IMG"] = array("ALIGN", "ALT", "SRC", "BORDER", "DYNSRC", "HEIGHT", "HSPACE", "ISMAP", "LOOP", "LOWSRC", "START", "UNITS", "USEMAP", "WIDTH", "VSPACE", "onLoad", "STYLE"); -// $data["INPUT"] = array("TYPE", "NAME", "VALUE", "onLoad", "STYLE"); -// $data["ISINDEX"] = array("HREF", "PROMPT", "onLoad", "STYLE"); -$data["LI"] = array("SRC", "DINGBAT", "SKIP", "TYPE", "VALUE", "onLoad", "STYLE"); -// $data["LINK"] = array("REL", "REV", "HREF", "TITLE", "onLoad", "STYLE"); -// $data["MAP"] = array("NAME", "onLoad", "STYLE"); -// $data["MARQUEE"] = array("ALIGN", "BEHAVIOR", "BGCOLOR", "DIRECTION", "HEIGHT", "HSPACE", "LOOP", "SCROLLAMOUNT", "SCROLLDELAY", "WIDTH", "VSPACE", "onLoad", "STYLE"); -// $data["MENU"] = array("onLoad", "STYLE"); -// $data["META"] = array("HTTP-EQUIV", "CONTENT", "NAME", "onLoad", "STYLE"); -// $data["MULTICOL"] = array("COLS", "GUTTER", "WIDTH", "onLoad", "STYLE"); -// $data["NOFRAMES"] = array("onLoad", "STYLE"); -// $data["NOTE"] = array("CLASS", "SRC", "onLoad", "STYLE"); -// $data["OVERLAY"] = array("SRC", "X", "Y", "HEIGHT", "WIDTH", "UNITS", "IMAGEMAP", "onLoad", "STYLE"); -// $data["PARAM"] = array("NAME", "VALUE", "onLoad", "STYLE"); -// $data["RANGE"] = array("FROM", "UNTIL", "onLoad", "STYLE"); -// $data["SCRIPT"] = array("LANGUAGE", "onLoad", "STYLE"); -// $data["SELECT"] = array("NAME", "SIZE", "MULTIPLE", "WIDTH", "HEIGHT", "UNITS", "onLoad", "STYLE"); -// $data["OPTION"] = array("VALUE", "SHAPE", "onLoad", "STYLE"); -// $data["SPACER"] = array("TYPE", "SIZE", "WIDTH", "HEIGHT", "ALIGN", "onLoad", "STYLE"); -// $data["SPOT"] = array("ID", "onLoad", "STYLE"); -// $data["TAB"] = array("INDENT", "TO", "ALIGN", "DP", "onLoad", "STYLE"); -$data["TABLE"] = array("ALIGN", "WIDTH", "BORDER", "CELLPADDING", "CELLSPACING", "BGCOLOR", "VALIGN", "COLSPEC", "UNITS", "DP", "onLoad", "STYLE"); -// $data["TBODY"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["TD"] = array("COLSPAN", "ROWSPAN", "ALIGN", "VALIGN", "BGCOLOR", "onLoad", "STYLE"); -// $data["TEXTAREA"] = array("NAME", "COLS", "ROWS", "onLoad", "STYLE"); -// $data["TEXTFLOW"] = array("CLASS", "ID", "onLoad", "STYLE"); -// $data["TFOOT"] = array("COLSPAN", "ROWSPAN", "ALIGN", "VALIGN", "BGCOLOR", "onLoad", "STYLE"); -$data["TH"] = array("ALIGN", "CLASS", "ID", "onLoad", "STYLE"); -// $data["TITLE"] = array("onLoad", "STYLE"); -$data["TR"] = array("ALIGN", "VALIGN", "BGCOLOR", "CLASS", "onLoad", "STYLE"); -$data["UL"] = array("SRC", "DINGBAT", "SKIP", "TYPE", "VALUE", "onLoad", "STYLE"); - -// Now add in a few that were not in the original, but which MediaWiki understands, even with -// extraneous attributes: -$data["gallery"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["pre"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["nowiki"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["blockquote"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["span"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["code"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["tt"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["small"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["big"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["s"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["u"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["del"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["ins"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["sub"] = array("CLASS", "ID", "onLoad", "STYLE"); -$data["ol"] = array("CLASS", "ID", "onLoad", "STYLE"); - - -// The types of the HTML that we will be testing were defined above -$types = array_keys($data); - -// Some attribute values. -$other = array("&","=",":","?","\"","\n","%n%n%n%n%n%n%n%n%n%n%n%n","\\"); -$ints = array("0","-1","127","7897","89000","808080","90928345","74326794236234","0xfffffff","ffff"); - -///////////////////////////////// WIKI-SYNTAX /////////////////////////// -/* Note: Defines various wiki-related bits of syntax, that can potentially cause - MediaWiki to do something other than just print that literal text */ -$ext = array( -"[[", "]]", "\n{|", "|}", "{{", "}}", "|", "[[image:", "[", "]", -"=", "==", "===", "====", "=====", "======", "\n*", "*", "\n:", ":", -"{{{", "}}}", -"\n", "\n#", "#", "\n;", ";", "\n ", -"----", "\n----", -"|]]", "~~~", "#REDIRECT [[", "'''", "''", -"ISBN 2", "\n|-", "| ", "\n| ", -"<!--", "-->", -"\"", "'", -">", -"http://","https://","url://","ftp://","file://","irc://","javascript:", -"!", -"\n! ", -"!!", -"||", -".gif", -".png", -".jpg", -".jpeg", -"<!--()()", -'%08X', -'/', -":x{|", -"\n|-", -"\n|+", -"<noinclude>", -"</noinclude>", -"\n-----", -"UNIQ25f46b0524f13e67NOPARSE", -" \302\273", -" :", -" !", -" ;", -"\302\253", -"RFC 000", -"PMID 000", -"?=", -"(", -")". -"]]]", -"../", -"{{{{", -"}}}}", -"{{subst:", -'__NOTOC__', -'__FORCETOC__', -'__NOEDITSECTION__', -'__START__', -'{{PAGENAME}}', -'{{PAGENAMEE}}', -'{{NAMESPACE}}', -'{{MSG:', -'{{MSGNW:', -'__END__', -'{{INT:', -'{{SITENAME}}', -'{{NS:', -'{{LOCALURL:', -'{{LOCALURLE:', -'{{SCRIPTPATH}}', -'{{GRAMMAR:', -'__NOTITLECONVERT__', -'__NOCONTENTCONVERT__', -"<!--MWTEMPLATESECTION=", -"<!--LINK 987-->", -"<!--IWLINK 987-->", -"Image:", -"[[category:", -"{{REVISIONID}}", -"{{SUBPAGENAME}}", -"{{SUBPAGENAMEE}}", -"{{ns:0}}", -"[[:Image", -"[[Special:", -"{{fullurl:}}", -'__TOC__', -"<includeonly>", -"</includeonly>", -"<math>", -"</math>" -); - - -///////////////////// A CLASS THAT GENERATES RANDOM STRINGS OF DATA ////////////////////// - -class htmler { - var $maxparams = 4; - var $maxtypes = 40; - - function randnum($finish,$start=0) { - return mt_rand($start,$finish); - } - - function randstring() { - global $ext; - $thestring = ""; - - for ($i=0; $i<40; $i++) { - $what = $this->randnum(1); - - if ($what == 0) { // include some random wiki syntax - $which = $this->randnum(count($ext) - 1); - $thestring .= $ext[$which]; - } - else { // include some random text - $char = chr(INCLUDE_BINARY ? $this->randnum(255) : $this->randnum(126,32)); - if ($char == "<") $char = ""; // we don't want the '<' character, it stuffs us up. - $length = $this->randnum(8); - $thestring .= str_repeat ($char, $length); - } - } - return $thestring; - } - - function makestring() { - global $ints, $other; - $what = $this->randnum(2); - if ($what == 0) { - return $this->randstring(); - } - elseif ($what == 1) { - return $ints[$this->randnum(count($ints) - 1)]; - } - else { - return $other[$this->randnum(count($other) - 1)]; - } - } - - function loop() { - global $types, $data; - $string = ""; - $i = $this->randnum(count($types) - 1); - $t = $types[$i]; - $arr = $data[$t]; - $string .= "<" . $types[$i] . " "; - for ($z=0; $z<$this->maxparams; $z++) { - $badparam = $arr[$this->randnum(count($arr) - 1)]; - $badstring = $this->makestring(); - $string .= $badparam . "=" . $badstring . " "; - } - $string .= ">\n"; - return $string; - } - - function main() { - $page = ""; - for ($k=0; $k<$this->maxtypes; $k++) { - $page .= $this->loop(); - } - return $page; - } -} - - -//////////////////// SAVING OUTPUT ///////////////////////// - - -/** -** @desc: Utility function for saving a file. Currently has no error checking. -*/ -function saveFile($string, $name) { - $fp = fopen ( DIRECTORY . "/" . $name, "w"); - fwrite($fp, $string); - fclose ($fp); -} - - -//////////////////// MEDIAWIKI PREVIEW ///////////////////////// - -/* -** @desc: Asks MediaWiki for a preview of a string. Returns the HTML. -*/ -function wikiPreview($text) { - - $params = array ( - "action" => "submit", - "wpMinoredit" => "1", - "wpPreview" => "Show preview", - "wpSection" => "new", - "wpEdittime" => "", - "wpSummary" => "This is a test", - "wpTextbox1" => $text - ); - - if( function_exists('curl_init') ) { - $ch = curl_init(); - } else { - die("Could not found 'curl_init' function. Is curl extension enabled ?\n"); - } - - curl_setopt($ch, CURLOPT_POST, 1); // save form using a POST - curl_setopt($ch, CURLOPT_POSTFIELDS, $params); // load the POST variables - curl_setopt($ch, CURLOPT_URL, WIKI_URL); // set url to post to - curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable - - $result=curl_exec ($ch); - - // if we encountered an error, then log it, and exit. - if (curl_error($ch)) { - trigger_error("Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) ); - print "Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) . " - exiting.\n"; - exit(); - } - - curl_close ($ch); - - return $result; -} - - -//////////////////// HTML VALIDATION ///////////////////////// - -/* -** @desc: Asks the validator whether this is valid HTML, or not. -*/ -function validateHTML($text) { - - $params = array ("fragment" => $text); - - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_POST, 1); // save form using a POST - curl_setopt($ch, CURLOPT_POSTFIELDS, $params); // load the POST variables - curl_setopt($ch, CURLOPT_URL, VALIDATOR_URL); // set url to post to - curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable - - $result=curl_exec ($ch); - - // if we encountered an error, then log it, and exit. - if (curl_error($ch)) { - trigger_error("Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) ); - print "Curl error #: " . curl_errno($ch) . " - " . curl_error ($ch) . " - exiting.\n"; - exit(); - } - - curl_close ($ch); - - $valid = (strpos($result, "Failed validation") === false ? true : false); - - return array($valid, $result); -} - - - -/** -** @desc: checks the string to see if tags are balanced. -*/ -function checkOpenCloseTags($string, $filename) { - $valid = true; - - $lines = explode("\n", $string); - - $num_lines = count($lines); - // print "Num lines: " . $num_lines . "\n"; - - foreach ($lines as $line_num => $line) { - - // skip mediawiki's own unbalanced lines. - if ($line_num == 15) continue; - if ($line == "\t\t<style type=\"text/css\">/*<![CDATA[*/") continue; - if ($line == "<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" id=\"wpTextbox1\" rows='25'") continue; - - if ($line == "/*<![CDATA[*/") continue; - if ($line == "/*]]>*/") continue; - if (ereg("^<form id=\"editform\" name=\"editform\" method=\"post\" action=\"", $line)) continue; - if (ereg("^enctype=\"multipart/form-data\"><input type=\"hidden\" name=\"wikidb_session\" value=\"", $line)) continue; // line num and content changes. - if ($line == "<textarea tabindex='1' accesskey=\",\" name=\"wpTextbox1\" rows='25'") continue; - if (ereg("^cols='80'>", $line)) continue; // line num and content changes. - - if ($num_lines - $line_num == 246) continue; - if ($num_lines - $line_num == 65) continue; - if ($num_lines - $line_num == 62) continue; - if ($num_lines - $line_num == 52) continue; - if ($num_lines - $line_num == 50) continue; - if ($num_lines - $line_num == 29) continue; - if ($num_lines - $line_num == 28) continue; - if ($num_lines - $line_num == 27) continue; - if ($num_lines - $line_num == 23) continue; - - if (substr_count($line, "<") > substr_count($line, ">")) { - print "\nUnclosed tag in " . DIRECTORY . "/" . $filename . " on line: " . ($line_num + 1) . " \n$line\n"; - $valid = false; - } - } - return $valid; -} - - -/** -** @desc: Get tidy to check for no HTML errors in the output file (e.g. unescaped strings). -*/ -function tidyCheckFile($name) { - $file = DIRECTORY . "/" . $name; - $x = `tidy -errors -quiet --show-warnings false $file 2>&1`; - if (trim($x) != "") { - print "Tidy errors found in $file:\n$x"; - return false; - } else { - return true; - } -} - - -////////////////////// TESTING FUNCTION //////////////////////// -/** -** @desc: takes a wiki markup string, and tests it for security or validation problems. -*/ -function testWikiMarkup($raw_markup, $testname) { - - // don't overwrite a previous test of the same name. - while (file_exists(DIRECTORY . "/" . $testname . ".raw_markup.txt")) { - $testname .= "-" . mt_rand(0,9); - } - - // upload to MediaWiki install. - $wiki_preview = wikiPreview($raw_markup); - - // save output files - saveFile($raw_markup, $testname . ".raw_markup.txt"); - saveFile($wiki_preview, $testname . ".wiki_preview.html"); - - // validate result - $valid = true; - if (VALIDATE_ON_WEB) list ($valid, $validator_output) = validateHTML($wiki_preview); - $valid = $valid && checkOpenCloseTags ($wiki_preview, $testname . ".wiki_preview.html"); - $valid = $valid && tidyCheckFile( $testname . ".wiki_preview.html" ); - - - if( $valid ) { - // Remove valid tests: - unlink( DIRECTORY . "/" . $testname . ".raw_markup.txt" ); - unlink( DIRECTORY . "/" . $testname . ".wiki_preview.html"); - } elseif( VALIDATE_ON_WEB ) { - saveFile($validator_output, $testname . ".validator_output.html"); - } -} - - -////////////////////// MAIN LOOP //////////////////////// - -// Make directory if doesn't exist -if (!is_dir(DIRECTORY)) { - mkdir (DIRECTORY, 0700 ); -} -// otherwise, retest the things that we have found in previous runs -else { - print "Retesting previously found problems.\n"; - - // create a handler for the directory - $handler = opendir(DIRECTORY); - - // keep going until all files in directory have been read - while ($file = readdir($handler)) { - - // if file is not raw markup, or is a retest, then skip it. - if (!ereg("\.raw_markup.txt$", $file)) continue; - if ( ereg("^retest-", $file)) continue; - - print "Retesting " . DIRECTORY . "/" . $file . "\n"; - - // get file contents - $markup = file_get_contents(DIRECTORY . "/" . $file); - - // run retest - testWikiMarkup($markup, "retest-" . $file); - } - - // tidy up: close the handler - closedir($handler); - - print "Done retesting.\n"; -} - -// seed the random number generator -mt_srand(crc32(microtime())); - -// main loop. -$h = new htmler(); - -print "Beginning main loop. Results are stored in the ".DIRECTORY." directory.\n"; -print "Press CTRL+C to stop testing.\n"; -for ($count=0; true /*$count<10000 */ ; $count++) { // while (true) - switch( $count % 4 ) { - case '0': print "\r/"; break; - case '1': print "\r-"; break; - case '2': print "\r\\"; break; - case '3': print "\r|"; break; - } - print " $count"; - - // generate and save text to test. - $raw_markup = $h->main(); - - // test this wiki markup - testWikiMarkup($raw_markup, $count); -} -?> |