mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Rename ETagMiddleware to ChangeDetectionMiddleware
This commit is contained in:
parent
b7e54bad24
commit
6b68495c0d
@ -11,7 +11,7 @@ SilverStripe\Core\Injector\Injector:
|
|||||||
SessionMiddleware: '%$SilverStripe\Control\Middleware\SessionMiddleware'
|
SessionMiddleware: '%$SilverStripe\Control\Middleware\SessionMiddleware'
|
||||||
RequestProcessorMiddleware: '%$SilverStripe\Control\RequestProcessor'
|
RequestProcessorMiddleware: '%$SilverStripe\Control\RequestProcessor'
|
||||||
FlushMiddleware: '%$SilverStripe\Control\Middleware\FlushMiddleware'
|
FlushMiddleware: '%$SilverStripe\Control\Middleware\FlushMiddleware'
|
||||||
ETagMiddleware: '%$SilverStripe\Control\Middleware\ETagMiddleware'
|
ChangeDetectionMiddleware: '%$SilverStripe\Control\Middleware\ChangeDetectionMiddleware'
|
||||||
HTTPCacheControleMiddleware: '%$SilverStripe\Control\Middleware\HTTPCacheControlMiddleware'
|
HTTPCacheControleMiddleware: '%$SilverStripe\Control\Middleware\HTTPCacheControlMiddleware'
|
||||||
CanonicalURLMiddleware: '%$SilverStripe\Control\Middleware\CanonicalURLMiddleware'
|
CanonicalURLMiddleware: '%$SilverStripe\Control\Middleware\CanonicalURLMiddleware'
|
||||||
SilverStripe\Control\Middleware\AllowedHostsMiddleware:
|
SilverStripe\Control\Middleware\AllowedHostsMiddleware:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace SilverStripe\Control;
|
namespace SilverStripe\Control;
|
||||||
|
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Control\Middleware\ETagMiddleware;
|
use SilverStripe\Control\Middleware\ChangeDetectionMiddleware;
|
||||||
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
|
use SilverStripe\Control\Middleware\HTTPCacheControlMiddleware;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Core\Config\Configurable;
|
use SilverStripe\Core\Config\Configurable;
|
||||||
@ -33,7 +33,7 @@ class HTTP
|
|||||||
protected static $modification_date = null;
|
protected static $modification_date = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 4.2..5.0 Handled by ETagMiddleware
|
* @deprecated 4.2..5.0 Handled by ChangeDetectionMiddleware
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected static $etag = null;
|
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
|
* @param string $etag
|
||||||
*/
|
*/
|
||||||
public static function register_etag($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) {
|
if (strpos($etag, '"') !== 0) {
|
||||||
$etag = "\"{$etag}\"";
|
$etag = "\"{$etag}\"";
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ class HTTP
|
|||||||
|
|
||||||
// Get current cache control state
|
// Get current cache control state
|
||||||
$cacheControlMiddleware = HTTPCacheControlMiddleware::singleton();
|
$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
|
// 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
|
// templates and other data. will be overridden by forced publicCache(true) or privateCache(true) calls
|
||||||
@ -491,7 +491,7 @@ class HTTP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run middleware
|
// 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 $cacheControlMiddleware->process($request, function (HTTPRequest $request) use ($response) {
|
||||||
return $response;
|
return $response;
|
||||||
});
|
});
|
||||||
|
@ -7,9 +7,10 @@ use SilverStripe\Control\HTTPResponse;
|
|||||||
use SilverStripe\Core\Injector\Injectable;
|
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;
|
use Injectable;
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user