Commit f959ce8f authored by alexpott's avatar alexpott

Issue #733054 followup by lussoluca: Fixed Watchdog logging of all searches is...

Issue #733054 followup by lussoluca: Fixed Watchdog logging of all searches is performance hit; need ability to turn it off.
parent d29adc88
......@@ -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 @@ public function __construct(SearchPageRepositoryInterface $search_page_repositor
*/
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 @@ public function view(Request $request, SearchPageInterface $entity) {
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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment