From f959ce8ffbf4a4fb1157eccefa18f00d38c81012 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 22 Jul 2014 21:00:58 +0100 Subject: [PATCH] Issue #733054 followup by lussoluca: Fixed Watchdog logging of all searches is performance hit; need ability to turn it off. --- .../search/src/Controller/SearchController.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/core/modules/search/src/Controller/SearchController.php b/core/modules/search/src/Controller/SearchController.php index 7865c8285741..fe90bdc9f204 100644 --- a/core/modules/search/src/Controller/SearchController.php +++ b/core/modules/search/src/Controller/SearchController.php @@ -26,24 +26,14 @@ class SearchController extends ControllerBase { */ protected $searchPageRepository; - /** - * The configuration factory. - * - * @var \Drupal\Core\Config\ConfigFactory - */ - protected $configFactory; - /** * Constructs a new search controller. * * @param \Drupal\search\SearchPageRepositoryInterface $search_page_repository * The search page repository. - * @param \Drupal\Core\Config\ConfigFactory $factory - * The configuration factory object. */ - public function __construct(SearchPageRepositoryInterface $search_page_repository, ConfigFactory $factory) { + public function __construct(SearchPageRepositoryInterface $search_page_repository) { $this->searchPageRepository = $search_page_repository; - $this->configFactory = $factory; } /** @@ -51,8 +41,7 @@ class SearchController extends ControllerBase { */ public static function create(ContainerInterface $container) { return new static( - $container->get('search.search_page_repository'), - $container->get('config.factory') + $container->get('search.search_page_repository') ); } @@ -87,7 +76,7 @@ class SearchController extends ControllerBase { if ($request->query->has('keys')) { if ($plugin->isSearchExecutable()) { // Log the search. - if ($this->configFactory->get('search.settings')->get('logging')) { + if ($this->config('search.settings')->get('logging')) { watchdog('search', 'Searched %type for %keys.', array('%keys' => $keys, '%type' => $entity->label()), WATCHDOG_NOTICE); }