Rename ETagMiddleware to ChangeDetectionMiddleware

This commit is contained in:
Damian Mooyman 2018-06-14 11:16:52 +12:00
parent b7e54bad24
commit 6b68495c0d
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
3 changed files with 10 additions and 9 deletions

View File

@ -11,7 +11,7 @@ SilverStripe\Core\Injector\Injector:
SessionMiddleware: '%$SilverStripe\Control\Middleware\SessionMiddleware'
RequestProcessorMiddleware: '%$SilverStripe\Control\RequestProcessor'
FlushMiddleware: '%$SilverStripe\Control\Middleware\FlushMiddleware'
ETagMiddleware: '%$SilverStripe\Control\Middleware\ETagMiddleware'
ChangeDetectionMiddleware: '%$SilverStripe\Control\Middleware\ChangeDetectionMiddleware'
HTTPCacheControleMiddleware: '%$SilverStripe\Control\Middleware\HTTPCacheControlMiddleware'
CanonicalURLMiddleware: '%$SilverStripe\Control\Middleware\CanonicalURLMiddleware'
SilverStripe\Control\Middleware\AllowedHostsMiddleware:

View File

@ -3,7 +3,7 @@
namespace SilverStripe\Control;
use SilverStripe\Assets\File;
use SilverStripe\Control\Middleware\ETagMiddleware;
use SilverStripe\Control\Middleware\ChangeDetectionMiddleware;
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Config\Configurable;
@ -33,7 +33,7 @@ class HTTP
protected static $modification_date = null;
/**
* @deprecated 4.2..5.0 Handled by ETagMiddleware
* @deprecated 4.2..5.0 Handled by ChangeDetectionMiddleware
* @var string
*/
protected static $etag = null;
@ -395,12 +395,12 @@ class HTTP
}
/**
* @deprecated 4.2..5.0 Use ETagMiddleware instead
* @deprecated 4.2..5.0 Use ChangeDetectionMiddleware instead
* @param string $etag
*/
public static function register_etag($etag)
{
Deprecation::notice('5.0', 'Use ETagMiddleware instead');
Deprecation::notice('5.0', 'Use ChangeDetectionMiddleware instead');
if (strpos($etag, '"') !== 0) {
$etag = "\"{$etag}\"";
}
@ -453,7 +453,7 @@ class HTTP
// Get current cache control state
$cacheControlMiddleware = HTTPCacheControlMiddleware::singleton();
$etagMiddleware = ETagMiddleware::singleton();
$changeDetectionMiddleware = ChangeDetectionMiddleware::singleton();
// if http caching is disabled by config, disable it - used on dev environments due to frequently changing
// templates and other data. will be overridden by forced publicCache(true) or privateCache(true) calls
@ -491,7 +491,7 @@ class HTTP
}
// Run middleware
$etagMiddleware->process($request, function (HTTPRequest $request) use ($cacheControlMiddleware, $response) {
$changeDetectionMiddleware->process($request, function (HTTPRequest $request) use ($cacheControlMiddleware, $response) {
return $cacheControlMiddleware->process($request, function (HTTPRequest $request) use ($response) {
return $response;
});

View File

@ -7,9 +7,10 @@ use SilverStripe\Control\HTTPResponse;
use SilverStripe\Core\Injector\Injectable;
/**
* Generates and handle responses for etag header.
* Handles internal change detection via etag / ifmodifiedsince headers,
* conditonally sending a 304 not modified if possible.
*/
class ETagMiddleware implements HTTPMiddleware
class ChangeDetectionMiddleware implements HTTPMiddleware
{
use Injectable;