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