mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #8770 from open-sausages/pulls/4/correct-doc-for-exec-metric-middleware
DOCS Correct documentation for ExecMetricMiddleware
This commit is contained in:
commit
6f619fa3e8
@ -9,13 +9,11 @@ use SilverStripe\Control\HTTPResponse;
|
|||||||
use SilverStripe\Dev\Debug;
|
use SilverStripe\Dev\Debug;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Secures requests by only allowing a whitelist of Host values
|
* Display execution metricts for the current request if in dev mode and `execmetric` is provided as a request variable.
|
||||||
*/
|
*/
|
||||||
class ExecMetricMiddleware implements HTTPMiddleware
|
class ExecMetricMiddleware implements HTTPMiddleware
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @inheritdoc
|
|
||||||
*/
|
|
||||||
public function process(HTTPRequest $request, callable $delegate)
|
public function process(HTTPRequest $request, callable $delegate)
|
||||||
{
|
{
|
||||||
if (!$this->showMetric($request)) {
|
if (!$this->showMetric($request)) {
|
||||||
@ -38,6 +36,11 @@ class ExecMetricMiddleware implements HTTPMiddleware
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if execution metric should be shown.
|
||||||
|
* @param HTTPRequest $request
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
private function showMetric(HTTPRequest $request)
|
private function showMetric(HTTPRequest $request)
|
||||||
{
|
{
|
||||||
return Director::isDev() && array_key_exists('execmetric', $request->getVars());
|
return Director::isDev() && array_key_exists('execmetric', $request->getVars());
|
||||||
|
Loading…
Reference in New Issue
Block a user