Commit 20799cf9 authored by catch's avatar catch
Browse files

Issue #2359369 by mpdonadio, Berdir, bdurbin: Render cache is not cleared when...

Issue #2359369 by mpdonadio, Berdir, bdurbin: Render cache is not cleared when module is uninstalled
parent c39c42c3
......@@ -10,6 +10,7 @@
use Drupal\Component\Graph\Graph;
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\String;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
......@@ -8,6 +8,7 @@
namespace Drupal\Core\Extension;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\DrupalKernelInterface;
......@@ -400,6 +401,14 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
// Let other modules react.
$this->moduleHandler->invokeAll('modules_uninstalled', array($module_list));
// Flush all persistent caches.
// Any cache entry might implicitly depend on the uninstalled modules,
// so clear all of them explicitly.
foreach (Cache::getBins() as $service_id => $cache_backend) {
return TRUE;
......@@ -7,6 +7,7 @@
namespace Drupal\system\Tests\Module;
use Drupal\Core\Cache\Cache;
use Drupal\Component\Utility\String;
use Drupal\simpletest\WebTestBase;
......@@ -74,8 +75,19 @@ function testUninstallPage() {
// labels.
$this->assertRaw('<h3>' . $entity_type->getLabel() . '</h3>');
// Set a unique cache entry to be able to test whether all caches are
// cleared during the uninstall.
\Drupal::cache()->set('uninstall_test', 'test_uninstall_page', Cache::PERMANENT);
$cached = \Drupal::cache()->get('uninstall_test');
$this->assertEqual($cached->data, 'test_uninstall_page', String::format('Cache entry found: @bin', array('@bin' => $cached->data)));
$this->drupalPostForm(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
$this->assertNoRaw('&lt;label', 'The page does not have double escaped HTML tags.');
// Make sure our unique cache entry is gone.
$cached = \Drupal::cache()->get('uninstall_test');
$this->assertFalse($cached, 'Cache entry not found');
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