core/modules/file/src/Tests/DownloadTest.php | 1 - .../image/src/Tests/ImageStylesPathAndUrlTest.php | 1 - core/modules/page_cache/page_cache.module | 39 +++++++++++++++++++--- .../src/Tests/PageCacheTagsIntegrationTest.php | 5 +++ core/modules/system/src/Form/PerformanceForm.php | 3 +- .../system/src/Tests/Session/SessionTest.php | 1 - core/modules/system/system.module | 2 +- 7 files changed, 43 insertions(+), 9 deletions(-) diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php index 165a76a..130b07c 100644 --- a/core/modules/file/src/Tests/DownloadTest.php +++ b/core/modules/file/src/Tests/DownloadTest.php @@ -57,7 +57,6 @@ public function testPrivateFileTransferWithoutPageCache() { public function testPrivateFileTransferWithPageCache() { // Turn on page caching and rerun the test. $this->assertTrue($this->container->get('module_installer')->install(['page_cache']), 'Page cache module installed.'); - $this->rebuildContainer(); $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); diff --git a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php index dba4cec..ebaa81c 100644 --- a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php @@ -248,7 +248,6 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = protected function enablePageCache() { // Turn on page caching and rerun the test. $this->assertTrue($this->container->get('module_installer')->install(['page_cache']), 'Page cache module installed.'); - $this->rebuildContainer(); $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); diff --git a/core/modules/page_cache/page_cache.module b/core/modules/page_cache/page_cache.module index 9f01823..2c7d01f 100644 --- a/core/modules/page_cache/page_cache.module +++ b/core/modules/page_cache/page_cache.module @@ -1,18 +1,49 @@ ' . t('About') . ''; + $output .= '

' . t('The Internal page cache module caches pages for anonymous users in the database.') . '

'; + $output .= '

' . t('Uses') . '

'; + $output .= '
'; + $output .= '
' . t('Speeding up your site') . '
'; + $output .= '
'; + $output .= '

' . t('Pages requested by anonymous users are stored in a compressed format; 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.'); + $output .= '

' . t('(For authenticated users, pages need to be assembled for each user individually, but anonymous users all get the exact same version of each page.)') . '

'; + $output .= '
'; + $output .= '
' . t('Configuring Internal page cache') . '
'; + $output .= '
'; + $output .= '

' . t('On the Performance settings page, 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'))) . '

'; + $output .= '
'; + $output .= '
'; + + return $output; + } +} /** * Implements hook_form_alter(). */ -function page_cache_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { +function page_cache_form_alter(&$form, FormStateInterface $form_state, $form_id) { // If the page that's being built is cacheable, set the 'immutable' flag, to // ensure that when the form is used, a new form build ID is generated when // appropriate, to prevent information disclosure. $request_policy = \Drupal::service('page_cache_request_policy'); $request = \Drupal::requestStack()->getCurrentRequest(); - $request_is_cacheable = $request_policy->check($request) === \Drupal\Core\PageCache\RequestPolicyInterface::ALLOW; + $request_is_cacheable = $request_policy->check($request) === RequestPolicyInterface::ALLOW; if ($request_is_cacheable) { $form_state->addBuildInfo('immutable', TRUE); } diff --git a/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php index 1d1b558..996362c 100644 --- a/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php +++ b/core/modules/page_cache/src/Tests/PageCacheTagsIntegrationTest.php @@ -23,6 +23,11 @@ class PageCacheTagsIntegrationTest extends WebTestBase { protected $profile = 'standard'; + /** + * {@inheritdoc} + */ + protected static $modules = ['page_cache']; + protected $dumpHeaders = TRUE; /** diff --git a/core/modules/system/src/Form/PerformanceForm.php b/core/modules/system/src/Form/PerformanceForm.php index e4a2de0..e007df9 100644 --- a/core/modules/system/src/Form/PerformanceForm.php +++ b/core/modules/system/src/Form/PerformanceForm.php @@ -121,6 +121,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'details', '#title' => t('Caching'), '#open' => TRUE, + '#description' => $this->t('Note: Drupal provides an internal page cache module that is recommended for small to medium-sized websites.'), ); // Identical options to the ones for block caching. // @see \Drupal\Core\Block\BlockBase::buildConfigurationForm() @@ -132,7 +133,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#title' => t('Page cache maximum age'), '#default_value' => $config->get('cache.page.max_age'), '#options' => $period, - '#description' => t('The maximum time a page can be cached. This is used as the value for max-age in Cache-Control headers.'), + '#description' => t('The maximum time a page can be cached by browsers and proxies. This is used as the value for max-age in Cache-Control headers.'), ); $directory = 'public://'; diff --git a/core/modules/system/src/Tests/Session/SessionTest.php b/core/modules/system/src/Tests/Session/SessionTest.php index c5a7220..95eae11 100644 --- a/core/modules/system/src/Tests/Session/SessionTest.php +++ b/core/modules/system/src/Tests/Session/SessionTest.php @@ -145,7 +145,6 @@ function testEmptyAnonymousSession() { // The same behavior is expected when caching is enabled. $this->assertTrue($this->container->get('module_installer')->install(['page_cache']), 'Page cache module installed.'); - $this->rebuildContainer(); $config = $this->config('system.performance'); $config->set('cache.page.max_age', 300); $config->save(); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 007595e..369e4a2 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -84,7 +84,7 @@ function system_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('Managing themes') . '
'; $output .= '
' . t('The System module allows users with the appropriate permissions to install and uninstall themes on the Appearance administration page. Themes determine the design and presentation of your site. Drupal comes packaged with several core themes, and additional contributed themes are available at the Drupal.org theme page.', array('@themes' => \Drupal::url('system.themes_page'), '@drupal-themes' => 'http://drupal.org/project/themes')) . '
'; $output .= '
' . t('Managing caching') . '
'; - $output .= '
' . t("The System module allows users with the appropriate permissions to manage caching on the Performance settings page. Drupal has a robust caching system that allows the efficient re-use of previously-constructed web pages and web page components. Pages requested by anonymous users are stored in a compressed format; 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.", array('@cache-settings' => \Drupal::url('system.performance_settings'))) . '
'; + $output .= '
' . t("The System module allows users with the appropriate permissions to manage caching on the Performance settings page. Drupal has a robust caching system that allows the efficient re-use of previously-constructed web page components.", array('@cache-settings' => \Drupal::url('system.performance_settings'))) . '
'; $output .= '
' . t('Performing system maintenance') . '
'; $output .= '
' . t('In order for the site and its modules to continue to operate well, a set of routine administrative operations must run on a regular basis. The System module manages this task by making use of a system cron job. You can verify the status of cron tasks by visiting the Status report page. For more information, see the online handbook entry for configuring cron jobs. You can set up cron job by visiting Cron configuration page', array('@status' => \Drupal::url('system.status'), '@handbook' => 'http://drupal.org/cron', '@cron' => \Drupal::url('system.cron_settings'))) . '
'; $output .= '
' . t('Configuring basic site settings') . '
';