Revert r85644. Multipart sucks because it is hard to parse and because you need to...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 9 Apr 2011 14:43:12 +0000 (14:43 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 9 Apr 2011 14:43:12 +0000 (14:43 +0000)
includes/Export.php

index 9157f4b..91eb7af 100644 (file)
@@ -35,8 +35,6 @@ class WikiExporter {
        var $author_list = "" ;
 
        var $dumpUploads = false;
-       var $multiPart = false;
-       var $files = array();
 
        const FULL = 1;
        const CURRENT = 2;
@@ -88,23 +86,12 @@ class WikiExporter {
 
        public function openStream() {
                $output = $this->writer->openStream();
-               
-               if ( $this->multiPart ) {
-                       $this->openMultipart();
-                       $this->sink->write( $output );
-               } else {
-                       $this->sink->writeOpenStream( $output );
-               }
+               $this->sink->writeOpenStream( $output );
        }
 
        public function closeStream() {
                $output = $this->writer->closeStream();
-               if ( $this->multiPart ) {
-                       $this->sink->write( $output );
-                       $this->closeMultipart();
-               } else {
-                       $this->sink->writeCloseStream( $output );
-               }
+               $this->sink->writeCloseStream( $output );
        }
 
        /**
@@ -327,7 +314,6 @@ class WikiExporter {
                                        $output = '';
                                        if ( $this->dumpUploads ) {
                                                $output .= $this->writer->writeUploads( $last );
-                                               $this->attachUploads( $last );
                                        }
                                        $output .= $this->writer->closePage();
                                        $this->sink->writeClosePage( $output );
@@ -343,7 +329,6 @@ class WikiExporter {
                        $output = '';
                        if ( $this->dumpUploads ) {
                                $output .= $this->writer->writeUploads( $last );
-                               $this->attachUploads( $last );
                        }
                        $output .= $this->author_list;
                        $output .= $this->writer->closePage();
@@ -357,38 +342,6 @@ class WikiExporter {
                        $this->sink->writeLogItem( $row, $output );
                }
        }
-       
-       protected function attachUploads( $row ) {
-               $title = Title::newFromRow( $row );
-               $file = wfLocalFile( $title );
-               $this->files[] = $file;
-               $this->files = array_merge( $this->files, $file->getHistory() );
-       }
-       
-       protected function openMultipart() {
-               # Multipart boundary purposely invalid XML
-               $this->boundary = '<' . dechex( mt_rand() ) . dechex( mt_rand() ) . '<';
-               $this->sink->writeOpenStream( 
-                       "Content-Type: multipart/related; boundary={$this->boundary};" .
-                               " type=text/xml\n\n" . 
-                       "--{$this->boundary}\nContent-Type: text/xml\n\n"
-               );
-       }
-       
-       protected function closeMultipart() {
-               $output = '';
-               
-               foreach ( $this->files as $file ) {
-                       $output .= "\n--{$this->boundary}\n" . 
-                               'Content-Type: ' . $file->getMimeType() . "\n" .
-                               'Content-ID: ' . $file->getRel() . "\n" . 
-                               'Content-Length: ' . $file->getSize() . "\n" .
-                               'X-Sha1Base36: ' . $file->getSha1() . "\n\n";
-                       $this->sink->write( $output );
-                       $this->sink->write( file_get_contents( $file->getPath() ) );  
-               }
-               $this->sink->writeCloseStream( "\n--{$this->boundary}\n" );
-       }
 }
 
 /**