mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
add support for gzip compression to style.php as well as adding a much higher expire date - though could be much more effective (but also error prone) due to the session id.
git-svn-id: file:///svn/phpbb/trunk@7949 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
074b6e127a
commit
04c3add2ee
1 changed files with 36 additions and 19 deletions
|
@ -126,6 +126,19 @@ if ($id && $sid)
|
|||
exit;
|
||||
}
|
||||
|
||||
// gzip_compression
|
||||
if ($config['gzip_compress'])
|
||||
{
|
||||
if (@extension_loaded('zlib') && !headers_sent())
|
||||
{
|
||||
ob_start('ob_gzhandler');
|
||||
}
|
||||
}
|
||||
|
||||
// Expire time of seven days if not recached
|
||||
$expire_time = 7*86400;
|
||||
$recache = false;
|
||||
|
||||
// Re-cache stylesheet data if necessary
|
||||
if ($recompile || empty($theme['theme_data']))
|
||||
{
|
||||
|
@ -156,36 +169,38 @@ if ($id && $sid)
|
|||
closedir($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($recache)
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
|
||||
header('Content-type: text/css; charset=UTF-8');
|
||||
|
||||
$theme['theme_data'] = acp_styles::db_theme_data($theme);
|
||||
$theme['theme_mtime'] = $update_time;
|
||||
if ($recache)
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
|
||||
|
||||
// Save CSS contents
|
||||
$sql_ary = array(
|
||||
'theme_mtime' => $theme['theme_mtime'],
|
||||
'theme_data' => $theme['theme_data']
|
||||
);
|
||||
$theme['theme_data'] = acp_styles::db_theme_data($theme);
|
||||
$theme['theme_mtime'] = $update_time;
|
||||
|
||||
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE theme_id = $id";
|
||||
$db->sql_query($sql);
|
||||
// Save CSS contents
|
||||
$sql_ary = array(
|
||||
'theme_mtime' => $theme['theme_mtime'],
|
||||
'theme_data' => $theme['theme_data']
|
||||
);
|
||||
|
||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
||||
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||
WHERE theme_id = $id";
|
||||
$db->sql_query($sql);
|
||||
|
||||
header('Expires: 0');
|
||||
}
|
||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
||||
|
||||
header('Cache-Control: private, no-cache="set-cookie"');
|
||||
header('Expires: 0');
|
||||
header('Pragma: no-cache');
|
||||
}
|
||||
else
|
||||
{
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
|
||||
header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $expire_time));
|
||||
}
|
||||
|
||||
header('Content-type: text/css');
|
||||
|
||||
// Parse Theme Data
|
||||
$replace = array(
|
||||
'{T_THEME_PATH}' => "{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme',
|
||||
|
@ -260,4 +275,6 @@ if ($id && $sid)
|
|||
$db->sql_close();
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
Loading…
Add table
Reference in a new issue