Skip to content
Snippets Groups Projects

Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS

Closed Issue #3238915: Refactor (if feasible) uses of the jQuery ready function to use VanillaJS
Closed Harumi Jang requested to merge issue/drupal-3238915:3238915-refactor-if-feasible into 9.3.x
1 file
+ 22
3
Compare changes
  • Side-by-side
  • Inline
  • 45c6d25c
    Issue #3254403 by paulmckibben, ranjith_kumar_k_u, longwave, Lendude, cilefen:... · 45c6d25c
    catch authored
    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)
@@ -5,6 +5,7 @@
@@ -5,6 +5,7 @@
* Post update functions for System.
* Post update functions for System.
*/
*/
 
use Drupal\Core\Site\Settings;
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\Core\Entity\Display\EntityDisplayInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
@@ -208,9 +209,27 @@ function system_post_update_delete_authorize_settings() {
@@ -208,9 +209,27 @@ function system_post_update_delete_authorize_settings() {
/**
/**
* Sort all configuration according to its schema.
* 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();
$factory = \Drupal::configFactory();
foreach ($factory->listAll() as $name) {
$iteration_size = Settings::get('entity_update_batch_size', 50);
$factory->getEditable($name)->save();
 
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;
}
}
}
}
Loading