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
25c41d0a
Commit
25c41d0a
authored
Apr 08, 2015
by
alexpott
Browse files
Issue
#606840
by Wim Leers, cilefen, Fabianx, markpavlitski: Enable internal page cache by default
parent
fe6ef2a7
Changes
10
Hide whitespace changes
Inline
Side-by-side
core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php
View file @
25c41d0a
...
...
@@ -17,7 +17,6 @@
* @Plugin(
* id = \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationBrowser::METHOD_ID,
* weight = -2,
* cache = 0,
* name = @Translation("Browser"),
* description = @Translation("Language from the browser's language settings."),
* config_route_name = "language.negotiation_browser"
...
...
@@ -36,6 +35,11 @@ class LanguageNegotiationBrowser extends LanguageNegotiationMethodBase {
public
function
getLangcode
(
Request
$request
=
NULL
)
{
$langcode
=
NULL
;
// Whenever browser-based language negotiation is used, the page cannot be
// cached by reverse proxies.
// @todo Solve more elegantly in https://www.drupal.org/node/2430335.
\
Drupal
::
service
(
'page_cache_kill_switch'
)
->
trigger
();
if
(
$this
->
languageManager
&&
$request
&&
$request
->
server
->
get
(
'HTTP_ACCEPT_LANGUAGE'
))
{
$http_accept_language
=
$request
->
server
->
get
(
'HTTP_ACCEPT_LANGUAGE'
);
$langcodes
=
array_keys
(
$this
->
languageManager
->
getLanguages
());
...
...
core/modules/system/src/Tests/Session/SessionTest.php
View file @
25c41d0a
...
...
@@ -141,7 +141,11 @@ function testDataPersistence() {
* Test that empty anonymous sessions are destroyed.
*/
function
testEmptyAnonymousSession
()
{
// Verify that no session is automatically created for anonymous user.
// Verify that no session is automatically created for anonymous user when
// page caching is disabled.
$config
=
$this
->
config
(
'system.performance'
);
$config
->
set
(
'cache.page.use_internal'
,
0
);
$config
->
save
();
$this
->
drupalGet
(
''
);
$this
->
assertSessionCookie
(
FALSE
);
$this
->
assertSessionEmpty
(
TRUE
);
...
...
core/modules/system/src/Tests/System/CronRunTest.php
View file @
25c41d0a
...
...
@@ -49,6 +49,12 @@ function testCronRun() {
* need the exact time when cron is triggered.
*/
function
testAutomaticCron
()
{
// Test with a logged in user; anonymous users likely don't cause Drupal to
// fully bootstrap, because of the internal page cache or an external
// reverse proxy. Reuse this user for disabling cron later in the test.
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer site configuration'
));
$this
->
drupalLogin
(
$admin_user
);
// Ensure cron does not run when the cron threshold is enabled and was
// not passed.
$cron_last
=
time
();
...
...
@@ -68,8 +74,6 @@ function testAutomaticCron() {
$this
->
assertTrue
(
$cron_last
<
\
Drupal
::
state
()
->
get
(
'system.cron_last'
),
'Cron runs when the cron threshold is passed.'
);
// Disable the cron threshold through the interface.
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer site configuration'
));
$this
->
drupalLogin
(
$admin_user
);
$this
->
drupalPostForm
(
'admin/config/system/cron'
,
array
(
'cron_safe_threshold'
=>
0
),
t
(
'Save configuration'
));
$this
->
assertText
(
t
(
'The configuration options have been saved.'
));
$this
->
drupalLogout
();
...
...
core/modules/user/user.routing.yml
View file @
25c41d0a
...
...
@@ -5,6 +5,9 @@ user.register:
_title
:
'
Create
new
account'
requirements
:
_access_user_register
:
'
TRUE'
# @todo Remove when https://www.drupal.org/node/2465053 lands.
options
:
no_cache
:
TRUE
user.logout
:
path
:
'
/user/logout'
...
...
core/modules/views/src/Tests/GlossaryTest.php
View file @
25c41d0a
...
...
@@ -70,10 +70,23 @@ public function testGlossaryView() {
// Enable the glossary to be displayed.
$view
->
storage
->
enable
()
->
save
();
$this
->
container
->
get
(
'router.builder'
)
->
rebuildIfNeeded
();
$url
=
Url
::
fromRoute
(
'view.glossary.page_1'
);
// Verify cache tags.
$this
->
assertPageCacheContextsAndTags
(
$url
,
[
'languages:'
.
LanguageInterface
::
TYPE_CONTENT
,
'languages:'
.
LanguageInterface
::
TYPE_INTERFACE
,
'theme'
,
'url'
,
'user.node_grants:view'
,
'user.permissions'
],
[
'config:views.view.glossary'
,
'node:'
.
$nodes_by_char
[
'a'
][
0
]
->
id
(),
'node:'
.
$nodes_by_char
[
'a'
][
1
]
->
id
(),
'node:'
.
$nodes_by_char
[
'a'
][
2
]
->
id
(),
'node_list'
,
'user_list'
,
'rendered'
,
// FinishResponseSubscriber adds this cache tag to responses that have the
// 'user.permissions' cache context for anonymous users.
'config:user.role.anonymous'
,
]);
// Check the actual page response.
$this
->
drupalGet
(
'glossary'
);
$this
->
drupalGet
(
$url
);
$this
->
assertResponse
(
200
);
foreach
(
$nodes_per_char
as
$char
=>
$count
)
{
$href
=
Url
::
fromRoute
(
'view.glossary.page_1'
,
[
'arg_0'
=>
$char
])
->
toString
();
$label
=
Unicode
::
strtoupper
(
$char
);
...
...
@@ -85,19 +98,6 @@ public function testGlossaryView() {
$result_count
=
trim
(
str_replace
(
array
(
'|'
,
'('
,
')'
),
''
,
(
string
)
$result
[
0
]));
$this
->
assertEqual
(
$result_count
,
$count
,
'The expected number got rendered.'
);
}
// Verify cache tags.
$this
->
enablePageCaching
();
$this
->
assertPageCacheContextsAndTags
(
Url
::
fromRoute
(
'view.glossary.page_1'
),
[
'languages:'
.
LanguageInterface
::
TYPE_CONTENT
,
'languages:'
.
LanguageInterface
::
TYPE_INTERFACE
,
'theme'
,
'url'
,
'user.node_grants:view'
,
'user.permissions'
],
[
'config:views.view.glossary'
,
'node:'
.
$nodes_by_char
[
'a'
][
0
]
->
id
(),
'node:'
.
$nodes_by_char
[
'a'
][
1
]
->
id
(),
'node:'
.
$nodes_by_char
[
'a'
][
2
]
->
id
(),
'node_list'
,
'user_list'
,
'rendered'
,
// FinishResponseSubscriber adds this cache tag to responses that have the
// 'user.permissions' cache context for anonymous users.
'config:user.role.anonymous'
,
]);
}
}
core/modules/views/src/Tests/Plugin/AccessTest.php
View file @
25c41d0a
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\views\Tests\Plugin
;
use
Drupal\Core\Cache\Cache
;
use
Drupal\views\Tests\ViewTestData
;
use
Drupal\views\Views
;
...
...
@@ -101,6 +102,14 @@ function testStaticAccessPlugin() {
// termination event fires. Simulate that here.
$this
->
container
->
get
(
'router.builder'
)
->
rebuildIfNeeded
();
// Clear the page cache.
// @todo Remove as part of https://www.drupal.org/node/2464657. The root
// cause is that the access plugins alters the route's access
// requirements. That means that the 403 from above does not have any
// cache tags, so modifying the View entity does not cause the cached 403
// page to be invalidated.
Cache
::
invalidateTags
([
'rendered'
]);
$this
->
assertTrue
(
$access_plugin
->
access
(
$this
->
normalUser
));
$this
->
drupalGet
(
'test_access_static'
);
...
...
core/profiles/minimal/config/install/system.performance.yml
0 → 100644
View file @
25c41d0a
cache
:
page
:
# @todo: Remove this file in https://www.drupal.org/node/2368987, update the
# install profile's YAML file to depend on the page_cache module instead.
use_internal
:
true
max_age
:
0
css
:
preprocess
:
true
gzip
:
true
fast_404
:
enabled
:
true
paths
:
'
/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'
exclude_paths
:
'
/\/(?:styles|imagecache)\//'
html
:
'
<!DOCTYPE
html><html><head><title>404
Not
Found</title></head><body><h1>Not
Found</h1><p>The
requested
URL
"@path"
was
not
found
on
this
server.</p></body></html>'
js
:
preprocess
:
true
gzip
:
true
response
:
gzip
:
false
stale_file_threshold
:
2592000
core/profiles/standard/config/install/system.performance.yml
0 → 100644
View file @
25c41d0a
cache
:
page
:
# @todo: Remove this file in https://www.drupal.org/node/2368987, update the
# install profile's YAML file to depend on the page_cache module instead.
use_internal
:
true
max_age
:
0
css
:
preprocess
:
true
gzip
:
true
fast_404
:
enabled
:
true
paths
:
'
/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'
exclude_paths
:
'
/\/(?:styles|imagecache)\//'
html
:
'
<!DOCTYPE
html><html><head><title>404
Not
Found</title></head><body><h1>Not
Found</h1><p>The
requested
URL
"@path"
was
not
found
on
this
server.</p></body></html>'
js
:
preprocess
:
true
gzip
:
true
response
:
gzip
:
false
stale_file_threshold
:
2592000
core/profiles/testing/config/install/system.performance.yml
0 → 100644
View file @
25c41d0a
cache
:
page
:
# @todo: Remove this file in https://www.drupal.org/node/2368987, update the
# install profile's YAML file to depend on the page_cache module instead.
use_internal
:
true
max_age
:
0
css
:
preprocess
:
true
gzip
:
true
fast_404
:
enabled
:
true
paths
:
'
/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'
exclude_paths
:
'
/\/(?:styles|imagecache)\//'
html
:
'
<!DOCTYPE
html><html><head><title>404
Not
Found</title></head><body><h1>Not
Found</h1><p>The
requested
URL
"@path"
was
not
found
on
this
server.</p></body></html>'
js
:
preprocess
:
true
gzip
:
true
response
:
gzip
:
false
stale_file_threshold
:
2592000
sites/example.settings.local.php
View file @
25c41d0a
...
...
@@ -28,7 +28,7 @@
$config
[
'system.performance'
][
'js'
][
'preprocess'
]
=
FALSE
;
/**
* Disable the render cache.
* Disable the render cache
(this includes the page cache)
.
*
* This setting disables the render cache by using the Null cache back-end
* defined by the development.services.yml file above.
...
...
Write
Preview
Markdown
is supported
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