individual message cache entries should start with ' ', also in memcached
[lhc/web/wiklou.git] / maintenance / importUseModWiki.php
index 15f5e44..0d01414 100644 (file)
@@ -22,8 +22,8 @@
  * 2005-03-14
  *
  * @todo document
- * @package MediaWiki
- * @subpackage Maintenance
+ * @file
+ * @ingroup Maintenance
  */
 
 if( php_sapi_name() != 'cli' ) {
@@ -46,7 +46,7 @@ $wgFieldSeparator = "\xb3"; # Some wikis may use different char
        $FS3 = $FS."3" ;
 
 # Unicode sanitization tools
-require_once( '../includes/normal/UtfNormal.php' );
+require_once( dirname( dirname( __FILE__ ) ) . '/includes/normal/UtfNormal.php' );
 
 $usercache = array();
 
@@ -59,7 +59,7 @@ function importPages()
        global $wgRootDirectory;
 
        $gt = '>';
-       echo <<<END
+       echo <<<XML
 <?xml version="1.0" encoding="UTF-8" ?$gt
 <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.1/"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -69,7 +69,7 @@ function importPages()
            xml:lang="en">
 <!-- generated by importUseModWiki.php -->
 
-END;
+XML;
        $letters = array(
                'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
@@ -79,10 +79,10 @@ END;
                if( is_dir( $dir ) )
                        importPageDirectory( $dir );
        }
-       echo <<<END
+       echo <<<XML
 </mediawiki>
 
-END;
+XML;
 }
 
 function importPageDirectory( $dir, $prefix = "" )
@@ -90,6 +90,7 @@ function importPageDirectory( $dir, $prefix = "" )
        echo "\n<!-- Checking page directory " . xmlCommentSafe( $dir ) . " -->\n";
        $mydir = opendir( $dir );
        while( $entry = readdir( $mydir ) ) {
+               $m = array();
                if( preg_match( '/^(.+)\.db$/', $entry, $m ) ) {
                        echo importPage( $prefix . $m[1] );
                } else {
@@ -121,7 +122,7 @@ function useModFilename( $title ) {
 
 function fetchPage( $title )
 {
-       global $FS,$FS1,$FS2,$FS3, $wgRootDirectory;
+       global $FS1,$FS2,$FS3, $wgRootDirectory;
 
        $fname = $wgRootDirectory . "/page/" . useModFilename( $title ) . ".db";
        if( !file_exists( $fname ) ) {
@@ -140,7 +141,7 @@ function fetchPage( $title )
 
 function fetchKeptPages( $title )
 {
-       global $FS,$FS1,$FS2,$FS3, $wgRootDirectory, $wgTimezoneCorrection;
+       global $FS1,$FS2,$FS3, $wgRootDirectory;
 
        $fname = $wgRootDirectory . "/keep/" . useModFilename( $title ) . ".kp";
        if( !file_exists( $fname ) ) return array();
@@ -226,27 +227,27 @@ function importPage( $title )
                 */
                $revisions = array( $page );
        }
-       $xml = <<<END
+       $xml = <<<XML
        <page>
                <title>$newtitle</title>
 
-END;
+XML;
 
        # History
        $revisions = array_merge( $revisions, fetchKeptPages( $title ) );
        if(count( $revisions ) == 0 ) {
-               return $sql;
+               return NULL; // Was "$sql", which does not appear to be defined.
        }
 
        foreach( $revisions as $rev ) {
                $text      = xmlsafe( recodeText( $rev->text ) );
                $minor     = ($rev->minor ? '<minor/>' : '');
-               list( $userid, $username ) = checkUserCache( $rev->username, $rev->host );
+               list( /* $userid */ , $username ) = checkUserCache( $rev->username, $rev->host );
                $username  = xmlsafe( recodeText( $username ) );
                $timestamp = xmlsafe( timestamp2ISO8601( $rev->ts ) );
                $comment   = xmlsafe( recodeText( $rev->summary ) );
 
-               $xml .= <<<END
+               $xml .= <<<XML
                <revision>
                        <timestamp>$timestamp</timestamp>
                        <contributor><username>$username</username></contributor>
@@ -255,7 +256,7 @@ END;
                        <text>$text</text>
                </revision>
 
-END;
+XML;
        }
        $xml .= "</page>\n\n";
        return $xml;
@@ -362,4 +363,4 @@ function nowikiPlaceholder( $matches ) {
        return placeholder();
 }
 
-?>
+