Skip to content
Snippets Groups Projects
Commit 2a38906e authored by Jess's avatar Jess
Browse files

Issue #3130341 by jungle, catch, longwave: Remove...

Issue #3130341 by jungle, catch, longwave: Remove Drupal\Core\Update\UpdateKernel::fixSerializedExtensionObjects()
parent 6f7f8b05
No related branches found
No related tags found
8 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage",!13Resolve #2903456
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
use Drupal\Core\Site\Settings; use Drupal\Core\Site\Settings;
use Drupal\Core\StackMiddleware\ReverseProxyMiddleware; use Drupal\Core\StackMiddleware\ReverseProxyMiddleware;
use Symfony\Cmf\Component\Routing\RouteObjectInterface; use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
...@@ -191,56 +190,4 @@ protected function handleAccess(Request $request) { ...@@ -191,56 +190,4 @@ protected function handleAccess(Request $request) {
} }
} }
/**
* {@inheritdoc}
*/
public function loadLegacyIncludes() {
parent::loadLegacyIncludes();
static::fixSerializedExtensionObjects($this->container);
}
/**
* Fixes caches and theme info if they contain old Extension objects.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* The container.
*
* @internal
* This function is only to be called by the Drupal core update process.
* Additionally, this function will be removed in minor release of Drupal.
*
* @todo https://www.drupal.org/project/drupal/issues/3031322 Remove once
* Drupal 8.6.x is not supported.
*/
public static function fixSerializedExtensionObjects(ContainerInterface $container) {
// Create a custom error handler that will clear caches if a warning occurs
// while getting 'system.theme.data' from state. If this state value was
// created by Drupal <= 8.6.7 then when it is read by Drupal >= 8.6.8 there
// will be PHP warnings. This silently fixes Drupal so that the update can
// continue.
$clear_caches = FALSE;
$callable = function ($errno, $errstr) use ($container, &$clear_caches) {
if ($errstr === 'Class Drupal\Core\Extension\Extension has no unserializer') {
$clear_caches = TRUE;
}
};
set_error_handler($callable, E_ERROR | E_WARNING);
$container->get('state')->get('system.theme.data', []);
restore_error_handler();
if ($clear_caches) {
// Reset static caches in profile list so the module list is rebuilt
// correctly.
$container->get('extension.list.profile')->reset();
foreach ($container->getParameter('cache_bins') as $service_id => $bin) {
$container->get($service_id)->deleteAll();
}
// The system.theme.data key is no longer used in Drupal 8.7.x.
$container->get('state')->delete('system.theme.data');
// Also rebuild themes because it uses state as cache.
$container->get('theme_handler')->refreshInfo();
}
}
} }
...@@ -32,12 +32,6 @@ protected function setUp(): void { ...@@ -32,12 +32,6 @@ protected function setUp(): void {
*/ */
public function testUpdate() { public function testUpdate() {
$connection = Database::getConnection(); $connection = Database::getConnection();
// Ensure \Drupal\Core\Update\UpdateKernel::fixSerializedExtensionObjects()
// does not clear the cache.
$connection->delete('key_value')
->condition('collection', 'state')
->condition('name', 'system.theme.data')
->execute();
// Create broken element info caches entries. // Create broken element info caches entries.
$insert = $connection->upsert('cache_discovery'); $insert = $connection->upsert('cache_discovery');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment