* (bug 3649) Remove obsolete, broken moveCustomMessages script
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 28 Oct 2005 09:47:40 +0000 (09:47 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 28 Oct 2005 09:47:40 +0000 (09:47 +0000)
RELEASE-NOTES
maintenance/archives/moveCustomMessages.inc [deleted file]
maintenance/archives/moveCustomMessages.php [deleted file]

index e8b5fa4..2ae0312 100644 (file)
@@ -187,6 +187,7 @@ fully support the editing toolbar, but was found to be too confusing.
   Why do people invent these crazy options that change language semantics?
 * (bug 3762) Define missing Special:Import UI messages
 * (bug 3771) Handle internal functions in backtrace in wfAbruptExit()
+* (bug 3649) Remove obsolete, broken moveCustomMessages script
 
 
 === Caveats ===
diff --git a/maintenance/archives/moveCustomMessages.inc b/maintenance/archives/moveCustomMessages.inc
deleted file mode 100644 (file)
index 83664dc..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-#### FIXME THIS FILE IS BADLY BROKEN FOR NEW SCHEMA
-/**
- * @deprecated
- * @package MediaWiki
- * @subpackage MaintenanceArchive
- */
-
-/** */
-function isTemplateInitialised() {
-       global $wgAllMessagesEn;
-       $fname = 'isTemplateInitialised';
-
-       $dbw =& wfGetDB( DB_MASTER );
-       $n = $dbw->selectField( 'page', 'count(*)', array( 'page_namespace' => NS_MEDIAWIKI ) );
-       return $n > count( $wgAllMessagesEn ) ? false : true;
-}
-
-function moveCustomMessages( $phase ) {
-       global $wgUser, $wgAllMessagesEn, $wgDeferredUpdateList, $wgLang, $wgContLang;
-       global $targets, $template, $replaceCount;
-
-       $wgUser = new User;
-       $wgUser->setLoaded( true ); # Don't load from DB
-       $wgUser->setName( "Template namespace initialisation script" );
-       $wgUser->addRight( "bot" );
-
-       $dbw =& wfGetDB( DB_MASTER );
-
-       $dbw->ignoreErrors( true );
-
-       # Compose DB key array
-       $dbkeys = array();
-
-       foreach ( $wgAllMessagesEn as $key => $enValue ) {
-               $title = Title::newFromText( $wgContLang->ucfirst( $key ) );
-               $dbkeys[$title->getDBkey()] = 1;
-       }
-
-       $res = $dbw->select( 'page', array( 'page_id', 'page_title' ), array( 'page_namespace' => NS_MEDIAWIKI ) );
-
-       # Compile target array
-       $targets = array();
-       while ( $row = $dbw->fetchObject( $res ) ) {
-               if ( !array_key_exists( $row->cur_title, $dbkeys ) ) {
-                       $targets[$row->cur_title] = 1;
-               }
-       }
-       $dbw->freeResult( $res );
-
-       # Create redirects from destination to source
-       if ( $phase == 0 || $phase == 1 ) {
-               print "Creating redirects\n";
-               foreach ( $targets as $partial => $dummy ) {
-                       print "$partial...";
-                       $nt = Title::makeTitle( NS_TEMPLATE, $partial );
-                       $ot = Title::makeTitle( NS_MEDIAWIKI, $partial );
-
-                       if ( $nt->createRedirect( $ot, "" ) ) {
-                               print "redirected\n";
-                       } else {
-                               print "not redirected\n";
-                       }
-               }
-               if ( $phase == 0 ) {
-                       print "\nRedirects created. Update live script files now.\nPress ENTER to continue.\n\n";
-                       readconsole();
-               }
-       }
-
-       # Move pages
-       if ( $phase == 0 || $phase == 2 ) {
-               print "\nMoving pages...\n";
-               foreach ( $targets as $partial => $dummy ) {
-                       $dbw->query( "BEGIN" );
-                       $ot = Title::makeTitle( NS_MEDIAWIKI, $partial );
-                       $nt = Title::makeTitle( NS_TEMPLATE, $partial );
-                       print "$partial...";
-
-                       if ( $ot->moveNoAuth( $nt ) === true ) {
-                               print "moved\n";
-                       } else {
-                               print "not moved\n";
-                       }
-                       # Do deferred updates
-                       while ( count( $wgDeferredUpdateList ) ) {
-                               $up = array_pop( $wgDeferredUpdateList );
-                               $up->doUpdate();
-                       }
-                       $dbw->query( "COMMIT" );
-               }
-       }
-
-       # Convert text
-       if ( $phase == 0 || $phase == 3 ) {
-               print "\nConverting text...\n";
-               
-               $parser = new Parser;
-               $options = ParserOptions::newFromUser( $wgUser );
-               $completedTitles = array();
-               $titleChars = Title::legalChars();
-               $mediaWiki = $wgLang->getNsText( NS_MEDIAWIKI );
-               $template = $wgLang->getNsText( NS_TEMPLATE );
-               $linkRegex = "/\[\[$mediaWiki:([$titleChars]*?)\]\]/";
-               $msgRegex = "/{{msg:([$titleChars]*?)}}/";
-
-               foreach ( $targets as $partial => $dummy ) {
-                       $dest = Title::makeTitle( NS_MEDIAWIKI, $partial );
-                       $linksTo = $dest->getLinksTo();
-                       foreach( $linksTo as $source ) {
-                               $dbw->query( "BEGIN" );
-                               $pdbk = $source->getPrefixedDBkey();
-                               if ( !array_key_exists( $pdbk, $completedTitles ) ) {   
-                                       $completedTitles[$pdbk] = 1;
-                                       $id = $source->getArticleID();
-                                       $row = $dbw->selectRow( 'cur', array( 'cur_text' ), 
-                                               array( 'cur_id' => $source->getArticleID() ) );
-                                       $parser->startExternalParse( $source, $options, OT_WIKI );
-                                       $text = $parser->strip( $row->cur_text, $stripState, false );
-                                       # {{msg}} -> {{}}
-                                       $text = preg_replace( $msgRegex, "{{\$1}}", $text );
-                                       # [[MediaWiki:]] -> [[Template:]]
-                                       $text = preg_replace_callback( $linkRegex, "wfReplaceMediaWiki", $text );
-                                       $text = $parser->unstrip( $text, $stripState );
-                                       $text = $parser->unstripNoWiki( $text, $stripState );
-                                       if ( $text != $row->cur_text ) {
-                                               print "$pdbk\n";
-                                               $art = new Article( $source );
-                                               $art->updateArticle( $text, "", false, false );
-                                               # Do deferred updates
-                                               while ( count( $wgDeferredUpdateList ) ) {
-                                                       $up = array_pop( $wgDeferredUpdateList );
-                                                       $up->doUpdate();
-                                               }
-                                       } else {
-                                               print "($pdbk)\n";
-                                       }
-                               } 
-                               $dbw->query( "COMMIT" );
-                       }
-               }
-       }
-}
-
-
-#--------------------------------------------------------------------------------------------------------------
-function wfReplaceMediaWiki( $m ) {
-       global $targets, $template, $replaceCount;
-       $title = Title::newFromText( $m[1] );
-       $partial = $title->getDBkey();
-
-       if ( array_key_exists( $partial, $targets ) ) {
-               $text = "[[$template:{$m[1]}]]";
-       } else {
-               $text = $m[0];
-       }
-       return $text;
-}
-
-?>
diff --git a/maintenance/archives/moveCustomMessages.php b/maintenance/archives/moveCustomMessages.php
deleted file mode 100644 (file)
index ea79bc2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * @deprecated
- * @package MediaWiki
- * @subpackage MaintenanceArchive
- */
-
-/** */
-
-# Move "custom messages" from the MediaWiki namespace to the Template namespace
-# Usage: php moveCustomMessages.php [<lang>] [phase]
-
-# Script works in three phases:
-#   1. Create redirects from Template to MediaWiki namespace. Skip if you don't want them
-#   2. Move pages from MediaWiki to Template namespace.
-#   3. Convert the text to suit the new syntax
-
-chdir( ".." );
-require_once( "liveCmdLine.inc" );
-require_once( "moveCustomMessages.inc" );
-
-$phase = 0;
-if ( is_numeric( @$argv[3] ) && $argv[3] > 0) {
-       $phase = intval($argv[3]);
-}
-
-moveCustomMessages( $phase );
-
-?>