Problem/Motivation

drupal_rebuild() does

  // Force kernel to rebuild php cache.
  PhpStorageFactory::get('twig')->deleteAll();
  // Invalidate the container.
  $kernel->invalidateContainer();

and

  foreach (Cache::getBins() as $bin) {
    $bin->deleteAll();
  }

all of this is done by drupal_flush_all_caches() which it calls.

Also

  // Disable recording of cached pages.
  \Drupal::service('page_cache_kill_switch')->trigger();

is called before drupal_flush_all_caches(); which seems wrong.

Proposed resolution

Fix it and try and add a test for it.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 2969737-2.patch1.28 KBalexpott

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new1.28 KB
alexpott’s picture

+++ b/core/includes/utility.inc
@@ -29,28 +27,18 @@ function drupal_rebuild($class_loader, Request $request) {
-  // Invalidate the container.
-  $kernel->invalidateContainer();
...
-  foreach (Cache::getBins() as $bin) {
-    $bin->deleteAll();
-  }

One question I guess is are there situations that doing this prior to drupal_flush_all_caches() are we fixing somethings will break if we just rely on drupal_flush_all_caches()

dawehner’s picture

alexpott’s picture

Yeah totally. Thanks @dawehner :)