Moved gzip stuff into options.

git-svn-id: http://svn.automattic.com/wordpress/trunk@646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2003-12-23 21:31:09 +00:00
parent 8f7d04c773
commit 85eaa93dd6
3 changed files with 23 additions and 5 deletions

View File

@ -115,6 +115,18 @@ if (!$wpdb->get_var("SELECT option_name FROM $tableoptions WHERE option_name = '
VALUES
('', '0', 'permalink_structure', 'Y', '3', '', '20', '8', 'How the permalinks for your site are constructed. See <a href=\"options-permalink.php\">permalink options page</a> for necessary mod_rewrite rules and more information.', '8');");
}
if (!$wpdb->get_var("SELECT option_name FROM $tableoptions WHERE option_name = 'gzipcompression'")) { // If it's not already there
$wpdb->query("INSERT INTO `$tableoptions`
(`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`)
VALUES
('', '0', 'gzipcompression', 'Y', '2', '0', '20', '8', 'Whether your output should be gzipped or not. Enable this if you don&#8217;t already have mod_gzip running.', '8');");
$optionid = $wpdb->get_var("SELECT option_id FROM $tableoptions WHERE option_name = 'gzipcompression'");
$wpdb->query("INSERT INTO $tableoptiongroup_options
(group_id, option_id, seq)
VALUES
(2, $optionid, 5)");
}
?>
Done with the name game. Now a little option action. </p>
<p>Now on to <a href="upgrade-072-to-080.php?step=2">step 2</a>.</p>

View File

@ -1,7 +1,4 @@
<?php
// We need to move this into options
$use_cache = 1;
$use_gzipcompression = 1;
/* Including config and functions files */
$curpath = dirname(__FILE__).'/';
@ -48,6 +45,8 @@ $archive_mode = get_settings('archive_mode');
$dateformat = stripslashes(get_settings('date_format'));
$timeformat = stripslashes(get_settings('time_format'));
$time_difference = get_settings('time_difference');
$use_cache = 1; // No reason not to
$use_gzipcompression = get_settings('gzipcompression');
/* First let's clear some variables */
$whichcat = '';

View File

@ -739,10 +739,17 @@ function gzip_compression() {
if (!$gzip_compressed) {
$phpver = phpversion(); //start gzip compression
if($phpver >= "4.0.4pl1") {
if(extension_loaded("zlib")) { ob_start("ob_gzhandler"); }
if(extension_loaded("zlib")) {
ob_start("ob_gzhandler");
}
} else if($phpver > "4.0") {
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip')) {
if(extension_loaded("zlib")) { $do_gzip_compress = TRUE; ob_start(); ob_implicit_flush(0); header("Content-Encoding: gzip"); }
if(extension_loaded("zlib")) {
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
header("Content-Encoding: gzip");
}
}
} //end gzip compression - that piece of script courtesy of the phpBB dev team
$gzip_compressed=1;