Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663
This commit is contained in:
parent
eb34d130a8
commit
f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions
|
@ -1,6 +1,6 @@
|
|||
name: Internal Page Cache
|
||||
type: module
|
||||
description: 'Caches pages for anonymous users. Works well for small to medium-sized websites.'
|
||||
description: 'Caches pages for anonymous users. Use when an external page cache is not available.'
|
||||
package: Core
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
|
|
|
@ -5,9 +5,8 @@
|
|||
* Caches responses for anonymous users, request and response policies allowing.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\PageCache\RequestPolicyInterface;
|
||||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
|
@ -16,14 +15,15 @@ function page_cache_help($route_name, RouteMatchInterface $route_match) {
|
|||
switch ($route_name) {
|
||||
case 'help.page.page_cache':
|
||||
$output = '<h3>' . t('About') . '</h3>';
|
||||
$output .= '<p>' . t('The Internal Page Cache module caches pages for anonymous users in the database. For more information, see the <a href="!pagecache-documentation">online documentation for the Internal Page Cache module</a>.', array('!pagecache-documentation' => 'https://www.drupal.org/documentation/modules/internal_page_cache')) . '</p>';
|
||||
$output .= '<p>' . t('The Internal Page Cache module caches pages for anonymous users in the database. For more information, see the <a href=":pagecache-documentation">online documentation for the Internal Page Cache module</a>.', array(':pagecache-documentation' => 'https://www.drupal.org/documentation/modules/internal_page_cache')) . '</p>';
|
||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||
$output .= '<dl>';
|
||||
$output .= '<dt>' . t('Speeding up your site') . '</dt>';
|
||||
$output .= '<dd>' . t('Pages requested by anonymous users are stored the first time they are requested and then are reused. Depending on your site configuration and the amount of your web traffic tied to anonymous visitors, the caching system may significantly increase the speed of your site.') . '</dd>';
|
||||
$output .= '<dd>' . t('Pages are usually identical for all anonymous users, while they can be customized for each authenticated user. This is why pages can be cached for anonymous users, whereas they will have to be rebuilt for every authenticated user.') . '</dd>';
|
||||
$output .= '<dd>' . t('Pages are usually identical for all anonymous users, while they can be personalized for each authenticated user. This is why entire pages can be cached for anonymous users, whereas they will have to be rebuilt for every authenticated user.') . '</dd>';
|
||||
$output .= '<dd>' . t('To speed up your site for authenticated users, see the <a href=":dynamic_page_cache-help">Dynamic Page Cache module</a>.', [':dynamic_page_cache-help' => (\Drupal::moduleHandler()->moduleExists('dynamic_page_cache')) ? Url::fromRoute('help.page', ['name' => 'dynamic_page_cache'])->toString() : '#']) . '</p>';
|
||||
$output .= '<dt>' . t('Configuring the internal page cache') . '</dt>';
|
||||
$output .= '<dd>' . t('On the <a href="!cache-settings">Performance page</a>, you can configure how long browsers and proxies may cache pages; that setting is also respected by the Internal Page Cache module. There is no other configuration.', array('!cache-settings' => \Drupal::url('system.performance_settings'))) . '</dd>';
|
||||
$output .= '<dd>' . t('On the <a href=":cache-settings">Performance page</a>, you can configure how long browsers and proxies may cache pages; that setting is also respected by the Internal Page Cache module. There is no other configuration.', array(':cache-settings' => \Drupal::url('system.performance_settings'))) . '</dd>';
|
||||
$output .= '</dl>';
|
||||
|
||||
return $output;
|
||||
|
|
|
@ -74,13 +74,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase {
|
|||
'route',
|
||||
'theme',
|
||||
'timezone',
|
||||
'user.permissions',
|
||||
// The user login block access depends on whether the current user is
|
||||
// logged in or not.
|
||||
'user.roles:anonymous',
|
||||
// The cache contexts associated with the (in)accessible menu links are
|
||||
// bubbled.
|
||||
'user.roles:authenticated',
|
||||
'user',
|
||||
// The placed block is only visible on certain URLs through a visibility
|
||||
// condition.
|
||||
'url',
|
||||
|
@ -91,10 +85,10 @@ class PageCacheTagsIntegrationTest extends WebTestBase {
|
|||
'rendered',
|
||||
'block_view',
|
||||
'config:block_list',
|
||||
'config:block.block.bartik_branding',
|
||||
'config:block.block.bartik_breadcrumbs',
|
||||
'config:block.block.bartik_content',
|
||||
'config:block.block.bartik_tools',
|
||||
'config:block.block.bartik_login',
|
||||
'config:block.block.bartik_footer',
|
||||
'config:block.block.bartik_help',
|
||||
'config:block.block.bartik_search',
|
||||
|
@ -105,10 +99,13 @@ class PageCacheTagsIntegrationTest extends WebTestBase {
|
|||
'config:block.block.bartik_messages',
|
||||
'config:block.block.bartik_local_actions',
|
||||
'config:block.block.bartik_local_tasks',
|
||||
'config:block.block.bartik_page_title',
|
||||
'node_view',
|
||||
'node:' . $node_1->id(),
|
||||
'user:0',
|
||||
'user:' . $author_1->id(),
|
||||
'config:filter.format.basic_html',
|
||||
'config:search.settings',
|
||||
'config:system.menu.account',
|
||||
'config:system.menu.tools',
|
||||
'config:system.menu.footer',
|
||||
|
@ -127,10 +124,10 @@ class PageCacheTagsIntegrationTest extends WebTestBase {
|
|||
'rendered',
|
||||
'block_view',
|
||||
'config:block_list',
|
||||
'config:block.block.bartik_branding',
|
||||
'config:block.block.bartik_breadcrumbs',
|
||||
'config:block.block.bartik_content',
|
||||
'config:block.block.bartik_tools',
|
||||
'config:block.block.bartik_login',
|
||||
'config:block.block.bartik_help',
|
||||
'config:block.block.bartik_search',
|
||||
'config:block.block.' . $block->id(),
|
||||
|
@ -141,10 +138,12 @@ class PageCacheTagsIntegrationTest extends WebTestBase {
|
|||
'config:block.block.bartik_messages',
|
||||
'config:block.block.bartik_local_actions',
|
||||
'config:block.block.bartik_local_tasks',
|
||||
'config:block.block.bartik_page_title',
|
||||
'node_view',
|
||||
'node:' . $node_2->id(),
|
||||
'user:' . $author_2->id(),
|
||||
'config:filter.format.full_html',
|
||||
'config:search.settings',
|
||||
'config:system.menu.account',
|
||||
'config:system.menu.tools',
|
||||
'config:system.menu.footer',
|
||||
|
@ -156,6 +155,7 @@ class PageCacheTagsIntegrationTest extends WebTestBase {
|
|||
// FinishResponseSubscriber adds this cache tag to responses that have the
|
||||
// 'user.permissions' cache context for anonymous users.
|
||||
'config:user.role.anonymous',
|
||||
'user:0',
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -399,11 +399,57 @@ class PageCacheTest extends WebTestBase {
|
|||
// that implementation.
|
||||
\Drupal::state()->set('page_cache_bypass_form_immutability', TRUE);
|
||||
\Drupal::moduleHandler()->resetImplementations();
|
||||
\Drupal::cache('render')->deleteAll();
|
||||
Cache::invalidateTags(['rendered']);
|
||||
|
||||
$this->drupalGet('page_cache_form_test_immutability');
|
||||
|
||||
$this->assertText("Immutable: FALSE", "Form is not immutable,");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests cacheability of a CacheableResponse.
|
||||
*
|
||||
* Tests the difference between having a controller return a plain Symfony
|
||||
* Response object versus returning a Response object that implements the
|
||||
* CacheableResponseInterface.
|
||||
*/
|
||||
public function testCacheableResponseResponses() {
|
||||
$config = $this->config('system.performance');
|
||||
$config->set('cache.page.max_age', 300);
|
||||
$config->save();
|
||||
|
||||
// Try to fill the cache.
|
||||
$this->drupalGet('/system-test/respond-reponse');
|
||||
$this->assertFalse(in_array('X-Drupal-Cache', $this->drupalGetHeaders()), 'Drupal page cache header not found');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'must-revalidate, no-cache, post-check=0, pre-check=0, private', 'Cache-Control header was sent');
|
||||
|
||||
// Still not cached, uncacheable response.
|
||||
$this->drupalGet('/system-test/respond-reponse');
|
||||
$this->assertFalse(in_array('X-Drupal-Cache', $this->drupalGetHeaders()), 'Drupal page cache header not found');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'must-revalidate, no-cache, post-check=0, pre-check=0, private', 'Cache-Control header was sent');
|
||||
|
||||
// Try to fill the cache.
|
||||
$this->drupalGet('/system-test/respond-cacheable-reponse');
|
||||
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'max-age=300, public', 'Cache-Control header was sent.');
|
||||
|
||||
// Should be cached now.
|
||||
$this->drupalGet('/system-test/respond-cacheable-reponse');
|
||||
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'max-age=300, public', 'Cache-Control header was sent.');
|
||||
|
||||
// Uninstall page cache. This should flush all caches so the next call to a
|
||||
// previously cached page should be a miss now.
|
||||
$this->container->get('module_installer')
|
||||
->uninstall(['page_cache']);
|
||||
|
||||
// Try to fill the cache.
|
||||
$this->drupalGet('/system-test/respond-reponse');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'must-revalidate, no-cache, post-check=0, pre-check=0, private', 'Cache-Control header was sent');
|
||||
|
||||
// Still not cached, uncacheable response.
|
||||
$this->drupalGet('/system-test/respond-reponse');
|
||||
$this->assertEqual($this->drupalGetHeader('Cache-Control'), 'must-revalidate, no-cache, post-check=0, pre-check=0, private', 'Cache-Control header was sent');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Reference in a new issue