Commit b9e5b737 authored by tonytheferg's avatar tonytheferg Committed by David Suissa
Browse files

Issue #3507579 by tonytheferg, dydave, berdir: Fixed Fatal error 'Controller...

Issue #3507579 by tonytheferg, dydave, berdir: Fixed Fatal error 'Controller for URI /en/admin/flush is not callable' by reverting change introduced in #3486841 with commit f6acda66.
parent c7667c63
Loading
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -90,10 +90,3 @@ admin_toolbar_tools.settings:
  description: 'Configure the Admin Toolbar Tools module.'
  route_name: admin_toolbar_tools.settings
  parent: system.admin_config_ui

system.run_reindex_site:
  title: 'Re-index Site'
  route_name: admin_toolbar.run.reindex.site
  menu_name: admin
  parent: admin_toolbar_tools.help
  weight: -9
+0 −9
Original line number Diff line number Diff line
@@ -95,12 +95,3 @@ admin_toolbar_tools.settings:
    _title: 'Admin Toolbar Tools settings'
  requirements:
    _permission: 'administer site configuration'

admin_toolbar.run.reindex.site:
  path: '/reindex-site'
  defaults:
    _controller: '\Drupal\admin_toolbar_tools\Controller\ToolbarController::runReindexSite'
    _title: 'Re-index Site'
  requirements:
    _permission: 'administer site configuration'
    _csrf_token: 'TRUE'
+2 −29
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ use Drupal\Core\Menu\MenuLinkManagerInterface;
use Drupal\Core\Plugin\CachedDiscoveryClearerInterface;
use Drupal\Core\Template\TwigEnvironment;
use Drupal\Core\Theme\Registry;
use Drupal\search\SearchPageRepositoryInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -109,13 +108,6 @@ class ToolbarController extends ControllerBase {
   */
  protected $themeRegistry;

  /**
   * The search page repository service.
   *
   * @var \Drupal\search\SearchPageRepositoryInterface
   */
  protected SearchPageRepositoryInterface $searchPageRepository;

  /**
   * Constructs a ToolbarController object.
   *
@@ -143,8 +135,6 @@ class ToolbarController extends ControllerBase {
   *   A TwigEnvironment instance.
   * @param \Drupal\Core\Theme\Registry $theme_registry
   *   The theme.registry service.
   * @param \Drupal\search\SearchPageRepositoryInterface $search_page_repository
   *   The search page repository service.
   */
  public function __construct(
    CronInterface $cron,
@@ -158,9 +148,8 @@ class ToolbarController extends ControllerBase {
    CachedDiscoveryClearerInterface $plugin_cache_clearer,
    CacheBackendInterface $cache_menu,
    TwigEnvironment $twig,
    Registry $theme_registry,
    // phpcs:ignore Drupal.Functions.MultiLineFunctionDeclaration.MissingTrailingComma
    SearchPageRepositoryInterface $search_page_repository
    Registry $theme_registry
  ) {
    $this->cron = $cron;
    $this->menuLinkManager = $menuLinkManager;
@@ -174,7 +163,6 @@ class ToolbarController extends ControllerBase {
    $this->cacheMenu = $cache_menu;
    $this->twig = $twig;
    $this->themeRegistry = $theme_registry;
    $this->searchPageRepository = $search_page_repository;
  }

  /**
@@ -193,8 +181,7 @@ class ToolbarController extends ControllerBase {
      $container->get('plugin.cache_clearer'),
      $container->get('cache.menu'),
      $container->get('twig'),
      $container->get('theme.registry'),
      $container->get('search.search_page_repository')
      $container->get('theme.registry')
    );
  }

@@ -306,18 +293,4 @@ class ToolbarController extends ControllerBase {
    return new RedirectResponse($this->reloadPage());
  }

  /**
   * Reindexes all active search pages.
   */
  public function runReindexSite() {
    // Ask each active search page to mark itself for re-index.
    foreach ($this->searchPageRepository->getIndexableSearchPages() as $entity) {
      $entity->getPlugin()->markForReindex();
    }
    // Run the cron to process the reindexing.
    $this->cron->run();
    $this->messenger()->addMessage($this->t('All search indexes have been rebuilt.'));
    return new RedirectResponse($this->reloadPage());
  }

}