CommandLineOrUnsafeMethod
class CommandLineOrUnsafeMethod implements RequestPolicyInterface (View source)
Reject when running from the command line or when HTTP method is not safe.
The policy denies caching if the request was initiated from the command line interface (drush) or the request method is neither GET nor HEAD (see RFC 2616, section 9.1.1 - Safe Methods).
Methods
Determines whether delivery of a cached page should be attempted.
Indicates whether this is a CLI request.
Details
string|null
check(Request $request)
Determines whether delivery of a cached page should be attempted.
Note that the request-policy check runs very early. In particular it is not possible to determine the logged in user. Also the current route match is not yet present when the check runs. Therefore, request-policy checks need to be designed in a way such that they do not depend on any other service and only take in account the information present on the incoming request.
When matching against the request path, special attention is needed to support path prefixes which are often used on multilingual sites.
protected
isCli()
Indicates whether this is a CLI request.