Tweaks for valid output
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 14 Mar 2005 13:19:24 +0000 (13:19 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 14 Mar 2005 13:19:24 +0000 (13:19 +0000)
maintenance/importUseModWiki.php

index 7011bfb..46eed2b 100644 (file)
@@ -64,7 +64,8 @@ function importPages()
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.1/
                                http://www.mediawiki.org/xml/export-0.1.xsd"
-           version="0.1">
+           version="0.1"
+           xml:lang="en">
 <!-- generated by importUseModWiki.php -->
 
 END;
@@ -85,7 +86,7 @@ END;
 
 function importPageDirectory( $dir, $prefix = "" )
 {
-       echo "\n<!-- Checking page directory $dir -->\n";
+       echo "\n<!-- Checking page directory " . xmlCommentSafe( $dir ) . " -->\n";
        $mydir = opendir( $dir );
        while( $entry = readdir( $mydir ) ) {
                if( preg_match( '/^(.+)\.db$/', $entry, $m ) ) {
@@ -154,7 +155,7 @@ function fetchKeptPages( $title )
                                "minor" => $text["minor"] , "ts" => $section["ts"] ,
                                "username" => $section["username"] , "host" => $section["host"] ) ) );
                } else {
-                       echo "-- skipped a bad old revision\n";
+                       echo "<!-- skipped a bad old revision -->\n";
                }
        }
        return $revisions;
@@ -247,8 +248,8 @@ END;
                <revision>
                        <timestamp>$timestamp</timestamp>
                        <contributor><username>$username</username></contributor>
-                       <comment>$comment</comment>
                        $minor
+                       <comment>$comment</comment>
                        <text>$text</text>
                </revision>
 
@@ -308,7 +309,7 @@ function xmlsafe( $string ) {
 }
 
 function xmlCommentSafe( $text ) {
-       return str_replace( '--', '\\-\\-', xmlsafe( $text ) );
+       return str_replace( '--', '\\-\\-', xmlsafe( recodeText( $text ) ) );
 }