Skip to content
Snippets Groups Projects
Unverified Commit 167dc216 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3422977 by secretsayan, traviscarden, nexusnovaz, joachim, smustgrave,...

Issue #3422977 by secretsayan, traviscarden, nexusnovaz, joachim, smustgrave, xjm, catch: Rename locale batch operation callbacks to match the API methods they call

(cherry picked from commit 6b6facdc)
parent ddf8b86e
Branches
Tags
29 merge requests!12227Issue #3181946 by jonmcl, mglaman,!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete,!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator,!10570Issue #3494197: Convert Twig engine hooks,!10567Issue #3494154: Index is not added if entity doesn't support revisions,!10548Revert "Issue #3478621 by catch, longwave, nicxvan: Add filecache to OOP hook attribute parsing",!10404Margin has been added,!10391Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10388Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10376Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10237Issue #3484105 by nicxvan, godotislate: Automatically included .inc files are no longer included
Pipeline #342196 canceled
Pipeline: drupal

#342198

    ......@@ -571,7 +571,7 @@ function locale_config_batch_update_components(array $options, array $langcodes
    * @return array
    * The batch definition.
    *
    * @see locale_config_batch_refresh_name()
    * @see locale_config_batch_update_config_translations()
    */
    function locale_config_batch_build(array $names, array $langcodes, array $options = [], bool $update_default_config_langcodes = FALSE) {
    $options += ['finish_feedback' => TRUE];
    ......@@ -582,7 +582,7 @@ function locale_config_batch_build(array $names, array $langcodes, array $option
    ->setErrorMessage(t('Error updating configuration translations'));
    if ($update_default_config_langcodes && \Drupal::languageManager()->getDefaultLanguage()->getId() !== 'en') {
    $batch_builder->addOperation('locale_config_batch_set_config_langcodes');
    $batch_builder->addOperation('locale_config_batch_update_default_config_langcodes');
    }
    // Chunking the array of names into batches of 20 for better performance.
    ......@@ -593,7 +593,7 @@ function locale_config_batch_build(array $names, array $langcodes, array $option
    // it is very expensive to initialize the \Drupal::config() object on each
    // request. We batch a small number of configuration object upgrades
    // together to improve the overall performance of the process.
    $batch_builder->addOperation('locale_config_batch_refresh_name', [$chunk, $langcodes]);
    $batch_builder->addOperation('locale_config_batch_update_config_translations', [$chunk, $langcodes]);
    }
    if (!empty($options['finish_feedback'])) {
    ......@@ -610,12 +610,30 @@ function locale_config_batch_build(array $names, array $langcodes, array $option
    * @param array|\ArrayAccess $context
    * The batch context.
    */
    function locale_config_batch_set_config_langcodes(&$context) {
    function locale_config_batch_update_default_config_langcodes(&$context): void {
    \Drupal::service('locale.config_manager')->updateDefaultConfigLangcodes();
    $context['finished'] = 1;
    $context['message'] = t('Updated default configuration to %langcode', ['%langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId()]);
    }
    /**
    * Implements callback_batch_operation().
    *
    * Updates default configuration when new modules or themes are installed.
    *
    * @param array|\ArrayAccess $context
    * The batch context.
    *
    * @deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use
    * locale_config_batch_update_default_config_langcodes(&$context) instead.
    *
    * @see https://www.drupal.org/node/3475054
    */
    function locale_config_batch_set_config_langcodes(&$context): void {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use locale_config_batch_update_default_config_langcodes() instead. See https://www.drupal.org/node/3475054', E_USER_DEPRECATED);
    locale_config_batch_update_default_config_langcodes($context);
    }
    /**
    * Implements callback_batch_operation().
    *
    ......@@ -630,7 +648,7 @@ function locale_config_batch_set_config_langcodes(&$context) {
    *
    * @see locale_config_batch_build()
    */
    function locale_config_batch_refresh_name(array $names, array $langcodes, &$context) {
    function locale_config_batch_update_config_translations(array $names, array $langcodes, &$context): void {
    if (!isset($context['results']['stats']['config'])) {
    $context['results']['stats']['config'] = 0;
    }
    ......@@ -643,6 +661,28 @@ function locale_config_batch_refresh_name(array $names, array $langcodes, &$cont
    $context['finished'] = 1;
    }
    /**
    * Implements callback_batch_operation().
    *
    * Performs configuration translation refresh.
    *
    * @param array $names
    * An array of names of configuration objects to update.
    * @param array $langcodes
    * (optional) Array of language codes to update. Defaults to all languages.
    * @param array|\ArrayAccess $context
    * Contains a list of files imported.
    *
    * @deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use
    * locale_config_batch_update_config_translations($names, $langcodes, $context) instead.
    *
    * @see https://www.drupal.org/node/3475054
    */
    function locale_config_batch_refresh_name(array $names, array $langcodes, &$context): void {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use locale_config_batch_update_config_translations() instead. See https://www.drupal.org/node/3475054', E_USER_DEPRECATED);
    locale_config_batch_update_config_translations($names, $langcodes, $context);
    }
    /**
    * Implements callback_batch_finished().
    *
    ......
    <?php
    declare(strict_types=1);
    namespace Drupal\Tests\locale\Unit;
    use Drupal\Core\DependencyInjection\ContainerBuilder;
    use Drupal\Tests\UnitTestCase;
    /**
    * Tests locale.bulk.inc.
    *
    * @group locale
    */
    class LocaleBulkDeprecationTest extends UnitTestCase {
    protected function setUp(): void {
    parent::setUp();
    $container = new ContainerBuilder();
    $container->set('locale.config_manager', $this->createMock('Drupal\locale\LocaleConfigManager'));
    $language_manager = $this->createMock('Drupal\Core\Language\LanguageManagerInterface');
    $language_manager->expects($this->any())
    ->method('getDefaultLanguage')
    ->willReturn($this->createMock('Drupal\Core\Language\LanguageInterface'));
    $container->set('language_manager', $language_manager);
    \Drupal::setContainer($container);
    include_once DRUPAL_ROOT . '/core/modules/locale/locale.bulk.inc';
    }
    /**
    * Tests the deprecation of locale_config_batch_refresh_name().
    *
    * @group legacy
    *
    * @see locale_config_batch_refresh_name()
    */
    public function testDeprecatedLocaleConfigBatchRefreshName(): void {
    $this->expectDeprecation('locale_config_batch_refresh_name() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use locale_config_batch_update_config_translations() instead. See https://www.drupal.org/node/3475054');
    $names = ['English', 'German'];
    $langcodes = ['en', 'de'];
    locale_config_batch_refresh_name($names, $langcodes, $context);
    }
    /**
    * Tests the deprecation of locale_config_batch_set_config_langcodes().
    *
    * @group legacy
    *
    * @see locale_config_batch_set_config_langcodes()
    */
    public function testDeprecatedLocaleConfigBatchSetConfigLangcodes(): void {
    $this->expectDeprecation('locale_config_batch_set_config_langcodes() is deprecated in drupal:11.1.0 and is removed from drupal:12.0.0. Use locale_config_batch_update_default_config_langcodes() instead. See https://www.drupal.org/node/3475054');
    $context = [];
    locale_config_batch_set_config_langcodes($context);
    }
    }
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment