[Profiler] Update ProfilerController.php
This commit is contained in:
parent
de3c7429e9
commit
6e0785f8c5
@ -54,11 +54,7 @@ class ProfilerController
|
||||
*/
|
||||
public function homeAction()
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
$this->denyAccessIfProfilerDisabled();
|
||||
|
||||
return new RedirectResponse($this->generator->generate('_profiler_search_results', ['token' => 'empty', 'limit' => 10]), 302, ['Content-Type' => 'text/html']);
|
||||
}
|
||||
@ -75,11 +71,7 @@ class ProfilerController
|
||||
*/
|
||||
public function panelAction(Request $request, $token)
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
$this->denyAccessIfProfilerDisabled();
|
||||
|
||||
if (null !== $this->cspHandler) {
|
||||
$this->cspHandler->disableCsp();
|
||||
@ -170,11 +162,7 @@ class ProfilerController
|
||||
*/
|
||||
public function searchBarAction(Request $request)
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
$this->denyAccessIfProfilerDisabled();
|
||||
|
||||
if (null !== $this->cspHandler) {
|
||||
$this->cspHandler->disableCsp();
|
||||
@ -231,11 +219,7 @@ class ProfilerController
|
||||
*/
|
||||
public function searchResultsAction(Request $request, $token)
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
$this->denyAccessIfProfilerDisabled();
|
||||
|
||||
if (null !== $this->cspHandler) {
|
||||
$this->cspHandler->disableCsp();
|
||||
@ -276,11 +260,7 @@ class ProfilerController
|
||||
*/
|
||||
public function searchAction(Request $request)
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
$this->denyAccessIfProfilerDisabled();
|
||||
|
||||
$ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip'));
|
||||
$method = $request->query->get('method');
|
||||
@ -331,11 +311,7 @@ class ProfilerController
|
||||
*/
|
||||
public function phpinfoAction()
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
$this->denyAccessIfProfilerDisabled();
|
||||
|
||||
if (null !== $this->cspHandler) {
|
||||
$this->cspHandler->disableCsp();
|
||||
@ -395,6 +371,15 @@ class ProfilerController
|
||||
return $this->templateManager;
|
||||
}
|
||||
|
||||
private function denyAccessIfProfilerDisabled()
|
||||
{
|
||||
if (null === $this->profiler) {
|
||||
throw new NotFoundHttpException('The profiler must be enabled.');
|
||||
}
|
||||
|
||||
$this->profiler->disable();
|
||||
}
|
||||
|
||||
private function renderWithCspNonces(Request $request, $template, $variables, $code = 200, $headers = ['Content-Type' => 'text/html'])
|
||||
{
|
||||
$response = new Response('', $code, $headers);
|
||||
|
Reference in New Issue
Block a user