mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Don't run filters when using spark. Closes #1519
This commit is contained in:
parent
90f6f37111
commit
2047b5a1f5
2
spark
2
spark
@ -12,6 +12,8 @@
|
||||
* this class mainly acts as a passthru to the framework itself.
|
||||
*/
|
||||
|
||||
define('SPARKED', true);
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* BOOTSTRAP THE APPLICATION
|
||||
|
@ -297,15 +297,19 @@ class CodeIgniter
|
||||
|
||||
$uri = $this->request instanceof CLIRequest ? $this->request->getPath() : $this->request->uri->getPath();
|
||||
|
||||
$possibleRedirect = $filters->run($uri, 'before');
|
||||
if ($possibleRedirect instanceof RedirectResponse)
|
||||
// Never run filters when running through Spark cli
|
||||
if (! defined('SPARKED'))
|
||||
{
|
||||
return $possibleRedirect;
|
||||
}
|
||||
// If a Response instance is returned, the Response will be sent back to the client and script execution will stop
|
||||
if ($possibleRedirect instanceof ResponseInterface)
|
||||
{
|
||||
return $possibleRedirect->send();
|
||||
$possibleRedirect = $filters->run($uri, 'before');
|
||||
if ($possibleRedirect instanceof RedirectResponse)
|
||||
{
|
||||
return $possibleRedirect;
|
||||
}
|
||||
// If a Response instance is returned, the Response will be sent back to the client and script execution will stop
|
||||
if ($possibleRedirect instanceof ResponseInterface)
|
||||
{
|
||||
return $possibleRedirect->send();
|
||||
}
|
||||
}
|
||||
|
||||
$returned = $this->startController();
|
||||
@ -331,9 +335,17 @@ class CodeIgniter
|
||||
// so it can be used with the output.
|
||||
$this->gatherOutput($cacheConfig, $returned);
|
||||
|
||||
$filters->setResponse($this->response);
|
||||
// Run "after" filters
|
||||
$response = $filters->run($uri, 'after');
|
||||
// Never run filters when running through Spark cli
|
||||
if (! defined('SPARKED'))
|
||||
{
|
||||
$filters->setResponse($this->response);
|
||||
// Run "after" filters
|
||||
$response = $filters->run($uri, 'after');
|
||||
}
|
||||
else
|
||||
{
|
||||
$response = $this->response;
|
||||
}
|
||||
|
||||
if ($response instanceof Response)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user