* (bug 7508) Added option to compress HTML pages by dumpHTML.php
authorJimmy Collins <collinj@users.mediawiki.org>
Fri, 6 Oct 2006 23:34:09 +0000 (23:34 +0000)
committerJimmy Collins <collinj@users.mediawiki.org>
Fri, 6 Oct 2006 23:34:09 +0000 (23:34 +0000)
RELEASE-NOTES
maintenance/dumpHTML.inc
maintenance/dumpHTML.php

index 388f209..1fd102c 100644 (file)
@@ -269,6 +269,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Use ImageMagick -thumbnail option instead of -resize to avoid including
   excessive metadata in thumbs (requires ImageMagick 6.0.0 or newer).
 * (bug 7499) Corrections to Swedish talk namespace names
+* (bug 7508) Added option to compress HTML pages by dumpHTML.php
 
 
 == Languages updated ==
index 714f837..ca2a62d 100644 (file)
@@ -48,6 +48,9 @@ class DumpHTML {
        # 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;
 
@@ -478,6 +481,11 @@ class DumpHTML {
                $fullName = "{$this->dest}/$filename";
                $fullDir = dirname( $fullName );
 
+               if ( $this->compress ) {
+                       $fullName .= ".gz";
+                       $text = gzencode( $text, 9 );                           
+               }
+
                wfMkdirParents( $fullDir, 0755 );
 
                wfSuppressWarnings();
@@ -619,6 +627,7 @@ class DumpHTML {
                        }
                }
 
+       
                $sk =& $wgUser->getSkin();
                ob_start();
                $sk->outputPage( $wgOut );
@@ -739,6 +748,7 @@ ENDTEXT;
                                $url = str_replace( '$1', "../$iw/" . wfUrlencode( $this->getHashedFilename( $title ) ),
                                        $wgArticlePath );
                        }
+                       $url .= $this->compress ? ".gz" : "";
                        return false;
                } else {
                        return true;
@@ -773,7 +783,7 @@ ENDTEXT;
                if ( $url === false ) {
                        $url = str_replace( '$1', wfUrlencode( $this->getHashedFilename( $title ) ), $wgArticlePath );
                }
-
+               $url .= $this->compress ? ".gz" : "";
                return false;
        }
 
index bb1f285..5e347e4 100644 (file)
@@ -23,6 +23,7 @@
  * --force-copy         copy commons instead of symlink, needed for Wikimedia
  * --interlang          allow interlanguage links
  * --image-snapshot     copy all images used to the destination directory
+ * --compress           generate compressed version of the html pages
  */
 
 
@@ -91,6 +92,7 @@ $wgHTMLDump = new DumpHTML( array(
        'sliceNumerator' => $sliceNumerator,
        'sliceDenominator' => $sliceDenominator,
        'noOverwrite' => $options['no-overwrite'],
+       'compress' => $options['compress'],
 ));