Skip to content
Snippets Groups Projects
Commit 08a4f0fb authored by catch's avatar catch
Browse files

Issue #3254403 by paulmckibben, ranjith_kumar_k_u, longwave, Lendude, cilefen:...

Issue #3254403 by paulmckibben, ranjith_kumar_k_u, longwave, Lendude, cilefen: system_post_update_sort_all_config can exhaust PHP memory in 9.3.0

(cherry picked from commit d55c0cbd)
parent 51d7a6cf
No related branches found
No related tags found
15 merge requests!2496Issue #3222757 by lauriii, Wim Leers, nod_, rachel_norfolk, itmaybejj,...,!2366Issue #3285105 by Daniel Arend,!2304Issue #3258987: Class "Drupal\Core\Utility\Error" not found in _drupal_error_handler_real() due to bug in PHP 8.1.0-8.1.5,!2148Issue #3270899: Remove Color module from core,!2136Issue #3227824: Move the linkset functionality from the decoupled menus contributed module to core's system module,!2071Issue #927570: Setting 403 or 404 handler to a page that redirects leads to endless loop,!1975Issue #3269749: losing query params from user to user/login redirect,!1959Issue #3236497: Allow other modules to opt out of security release message from update_page_top,!1387Draft: Resolve #2511878 "Support enclosure field",!1282Issue #3227824: Add the decoupled menus module to core,!1229Issue #3225621: Use media query event listener instead of a listener on the resize event,!799Issue #3214332: Preview content is broken in Claro.,!776Resolve #85494 "Use email verification 9.3.x",!558Resolve #3020422 "Toolbar style update",!231Issue #2671162: summary text wysiwyg patch working fine on 9.2.0-dev
......@@ -5,6 +5,7 @@
* Post update functions for System.
*/
use Drupal\Core\Site\Settings;
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
......@@ -208,9 +209,27 @@ function system_post_update_delete_authorize_settings() {
/**
* Sort all configuration according to its schema.
*/
function system_post_update_sort_all_config() {
function system_post_update_sort_all_config(&$sandbox) {
$factory = \Drupal::configFactory();
foreach ($factory->listAll() as $name) {
$factory->getEditable($name)->save();
$iteration_size = Settings::get('entity_update_batch_size', 50);
if (empty($sandbox['progress'])) {
$sandbox['progress'] = 0;
$sandbox['all_config_names'] = $factory->listAll();
$sandbox['max'] = count($sandbox['all_config_names']);
}
$start = $sandbox['progress'];
$end = min($sandbox['max'], $start + $iteration_size);
for ($i = $start; $i < $end; $i++) {
$factory->getEditable($sandbox['all_config_names'][$i])->save();
}
if ($sandbox['max'] > 0 && $end < $sandbox['max']) {
$sandbox['progress'] = $end;
$sandbox['#finished'] = ($end - 1) / $sandbox['max'];
}
else {
$sandbox['#finished'] = 1;
}
}
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