Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
769e0afd
Commit
769e0afd
authored
Dec 07, 2011
by
gdd
Browse files
Updating references to page compression
parent
ee4f6008
Changes
2
Hide whitespace changes
Inline
Side-by-side
core/includes/bootstrap.inc
View file @
769e0afd
...
...
@@ -1323,8 +1323,10 @@ function drupal_page_header() {
* response is sent.
*/
function
drupal_serve_page_from_cache
(
stdClass
$cache
)
{
$config
=
config
(
'system.performance'
);
// Negotiate whether to use compression.
$page_compression
=
variable_
get
(
'page_compression'
,
TRUE
)
&&
extension_loaded
(
'zlib'
);
$page_compression
=
$config
->
get
(
'page_compression'
)
&&
extension_loaded
(
'zlib'
);
$return_compressed
=
$page_compression
&&
isset
(
$_SERVER
[
'HTTP_ACCEPT_ENCODING'
])
&&
strpos
(
$_SERVER
[
'HTTP_ACCEPT_ENCODING'
],
'gzip'
)
!==
FALSE
;
// Get headers set in hook_boot(). Keys are lower-case.
...
...
@@ -1350,7 +1352,6 @@ function drupal_serve_page_from_cache(stdClass $cache) {
// max-age > 0, allowing the page to be cached by external proxies, when a
// session cookie is present unless the Vary header has been replaced or
// unset in hook_boot().
$config
=
config
(
'system.performance'
);
$max_age
=
!
isset
(
$_COOKIE
[
session_name
()])
||
isset
(
$hook_boot_headers
[
'vary'
])
?
$config
->
get
(
'page_cache_maximum_age'
)
:
0
;
$default_headers
[
'Cache-Control'
]
=
'public, max-age='
.
$max_age
;
...
...
core/includes/common.inc
View file @
769e0afd
...
...
@@ -5064,7 +5064,8 @@ function _drupal_bootstrap_full() {
*/
function
drupal_page_set_cache
()
{
global
$base_root
;
$config
=
config
(
'system.performance'
);
if
(
drupal_page_is_cacheable
())
{
$cache
=
(
object
)
array
(
'cid'
=>
$base_root
.
request_uri
(),
...
...
@@ -5090,7 +5091,7 @@ function drupal_page_set_cache() {
}
if
(
$cache
->
data
[
'body'
])
{
if
(
variable_
get
(
'page_compression'
,
TRUE
)
&&
extension_loaded
(
'zlib'
))
{
if
(
$config
->
get
(
'page_compression'
)
&&
extension_loaded
(
'zlib'
))
{
$cache
->
data
[
'body'
]
=
gzencode
(
$cache
->
data
[
'body'
],
9
,
FORCE_GZIP
);
}
cache
(
'page'
)
->
set
(
$cache
->
cid
,
$cache
->
data
,
$cache
->
expire
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment