From: Jimmy Collins Date: Fri, 6 Oct 2006 23:34:09 +0000 (+0000) Subject: * (bug 7508) Added option to compress HTML pages by dumpHTML.php X-Git-Tag: 1.31.0-rc.0~55606 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=3f48f1073b32108e4e9f2fdb713e96af66f5e65f;p=lhc%2Fweb%2Fwiklou.git * (bug 7508) Added option to compress HTML pages by dumpHTML.php --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 388f209427..1fd102c909 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/maintenance/dumpHTML.inc b/maintenance/dumpHTML.inc index 714f837a37..ca2a62dc9d 100644 --- a/maintenance/dumpHTML.inc +++ b/maintenance/dumpHTML.inc @@ -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; } diff --git a/maintenance/dumpHTML.php b/maintenance/dumpHTML.php index bb1f285a24..5e347e4b5e 100644 --- a/maintenance/dumpHTML.php +++ b/maintenance/dumpHTML.php @@ -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'], ));