Issue #3032869 by alexpott, tim.plunkett, dww, tacituseu, Mixologic: \Drupal\Core\Update\UpdateKernel::fixSerializedExtensionObjects() caused test runs to double in duration

8.7.x
xjm 2019-02-14 12:07:07 -06:00
parent b503e4c3ae
commit f633f3b108
1 changed files with 13 additions and 6 deletions

View File

@ -218,7 +218,18 @@ class UpdateKernel extends DrupalKernel {
// created by Drupal <= 8.6.7 then when it is read by Drupal >= 8.6.8 there // 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 // will be PHP warnings. This silently fixes Drupal so that the update can
// continue. // continue.
$callable = function () use ($container) { $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 // Reset static caches in profile list so the module list is rebuilt
// correctly. // correctly.
$container->get('extension.list.profile')->reset(); $container->get('extension.list.profile')->reset();
@ -227,11 +238,7 @@ class UpdateKernel extends DrupalKernel {
} }
// Also rebuild themes because it uses state as cache. // Also rebuild themes because it uses state as cache.
$container->get('theme_handler')->refreshInfo(); $container->get('theme_handler')->refreshInfo();
}; }
set_error_handler($callable, E_ERROR | E_WARNING);
$container->get('state')->get('system.theme.data', []);
restore_error_handler();
} }
} }