Comments

srishti.bankar created an issue. See original summary.

srishtiiee’s picture

Status: Needs work » Needs review
StatusFileSize
new23.53 KB
srishtiiee’s picture

StatusFileSize
new23.04 KB
narendrar’s picture

Status: Needs review » Needs work

Tested manually and verified that all permissions/settings/categories are migrated properly except one setting (Consent storage method not migrated)

Small Nit:

+++ b/src/Plugin/migrate/source/EuCookieComplianceConfig.php
@@ -0,0 +1,48 @@
+/**
+ * Password policy migrate source plugin.
+ *

Update this.

srishtiiee’s picture

StatusFileSize
new23.16 KB
new1.65 KB
srishtiiee’s picture

Status: Needs work » Needs review
StatusFileSize
new22.94 KB
new4.11 KB

Updated source plugin to migrate all the configuration in a single yml file.

srishtiiee’s picture

StatusFileSize
new22.19 KB
new7.14 KB
srishtiiee’s picture

StatusFileSize
new22.22 KB
new574 bytes
narendrar’s picture

Status: Needs review » Needs work

Migration works for me.
Last nits from my side:

  1. +++ b/src/Plugin/migrate/process/ExcludePaths.php
    @@ -0,0 +1,29 @@
    +
    +/**
    + * Reforms eu_cookie_compliance exclude paths acc to D9.
    + *
    + * @MigrateProcessPlugin(
    

    Reforms eu_cookie_compliance exclude paths acc to D9. => Transforms EU cookie compliance exclude paths according to D9 guideline.

  2. +++ b/tests/src/Kernel/EuCookieComplianceMigrateTest.php
    @@ -0,0 +1,154 @@
    +
    +  /**
    +   * Tests eu_cookie_compliance settings migration.
    +   */
    +  public function testEuCookieComplianceSettingsMigration(): void {
    

    eu_cookie_compliance => EU cookie compliance

  3. +++ b/tests/src/Kernel/EuCookieComplianceMigrateTest.php
    @@ -0,0 +1,154 @@
    +    unset($config['cc_config']);
    

    Unnecessary

  4. +++ b/tests/src/Kernel/EuCookieComplianceMigrateTest.php
    @@ -0,0 +1,154 @@
    +  /**
    +   * Tests eu_cookie_compliance categories migration.
    +   */
    +  public function testEuCookieComplianceCategoriesMigration(): void {
    

    eu_cookie_compliance => EU cookie compliance

srishtiiee’s picture

StatusFileSize
new22.21 KB
new1.54 KB
huzooka’s picture

  1. +++ b/migrations/eu_cookie_compliance_categories.yml
    @@ -0,0 +1,15 @@
    +id: eu_cookie_compliance_categories
    ...
    +  plugin: eu_cookie_categories
    

    I would prefer a singular ID. That is the common practice in core (except of d7_views_modes)

  2. +++ b/migrations/eu_cookie_compliance_config.yml
    @@ -0,0 +1,68 @@
    +id: eu_cookie_compliance_config
    +label: Cookie compliance configuration
    +migration_tags:
    +  - Drupal 7
    +  - Configuration
    +source:
    +  plugin: eu_cookie_configuration
    

    Could you please change these to refer to the module settings more clearly? I mean change the migration's and the source plugin's ID to eu_cookie_compliance_settings?

  3. +++ b/migrations/eu_cookie_compliance_config.yml
    @@ -0,0 +1,68 @@
    +process:
    +  cookie_lifetime: eu_cookie_compliance_cookie_lifetime
    +  domain: eu_cookie_compliance_domain
    +  domain_all_sites: eu_cookie_compliance_domain_all_sites
    +  popup_enabled: 'popup_enabled'
    +  method: 'method'
    +  popup_info_template: 'info_template'
    

    👍 Most of these Drupal 7 values are always available: https://git.drupalcode.org/project/eu-cookie-compliance/-/blob/7.x-2.x/e..., except of eu_cookie_compliance_cookie_lifetime (this is 100), eu_cookie_compliance_domain or eu_cookie_compliance_domain_all_sites (this is 0).

    Maybe we don't have to take care of the default value of eu_cookie_compliance_domain, but the others might be important.

  4. +++ b/src/Plugin/migrate/process/ExcludePaths.php
    @@ -0,0 +1,29 @@
    + *   id = "exclude_paths"
    

    Please prefix the plugin ID with the module's name. This exclude_paths seems very generic to me.

  5. +++ b/src/Plugin/migrate/source/EuCookieComplianceConfig.php
    @@ -0,0 +1,49 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function prepareRow(Row $row) {
    +    $config = $this->select('variable', 'v')
    +      ->fields('v', ['value'])
    +      ->condition('v.name', 'eu_cookie_compliance')
    +      ->execute()
    +      ->fetchField();
    +    $config = $config !== FALSE ? unserialize($config) : [];
    +    foreach ($config as $key => $value) {
    +      $row->setSourceProperty($key, $value);
    +    }
    +    return parent::prepareRow($row);
    +  }
    

    Why don't you add eu_cookie_compliance to the variables configuration, just like you did with the other variables?

  6. +++ b/tests/src/Kernel/EuCookieComplianceMigrateTest.php
    @@ -0,0 +1,154 @@
    +  public function testEuCookieComplianceSettingsMigration(): void {
    ...
    +  public function testEuCookieComplianceCategoriesMigration(): void {
    

    Please merge these two test methods.

  7. +++ b/tests/src/Kernel/EuCookieComplianceMigrateTest.php
    @@ -0,0 +1,154 @@
    +    $category_1 = $this->config('eu_cookie_compliance.cookie_category.category_1')->getRawData();
    +    unset($category_1['uuid']);
    +    $this->assertSame($expected_config_cat1, $category_1);
    

    You should use Entity API:

    $category_1 = CookieCategory::load('category_1');
    
srishtiiee’s picture

Addressed issues mentioned in #11.

srishtiiee’s picture

Status: Needs work » Needs review
huzooka’s picture

Assigned: srishtiiee » Unassigned
Status: Needs review » Reviewed & tested by the community

Review of #13:

  1. +++ b/src/Plugin/migrate/source/EuCookieCategory.php
    @@ -0,0 +1,62 @@
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public function count($refresh = FALSE): int {
    +    return (int) $this->initializeIterator()->count();
    +  }
    

    In Drupal 9.3+, you should override only SqlBase::doCount(), but if you do so, it means that the patch won't support core 9.2 or lower. So this is 👍

  2. +++ b/src/Plugin/migrate/source/EuCookieComplianceSettings.php
    @@ -0,0 +1,33 @@
    +    $configuration['variables'] = [
    +      'eu_cookie_compliance',
    +      'eu_cookie_compliance_cookie_lifetime',
    +      'eu_cookie_compliance_domain',
    +      'eu_cookie_compliance_domain_all_sites',
    +    ];
    

    I would override the whole $configuration array, not just its variables configuration key, but this solution also works well! 👍

The most recent patch addresses every concern we raised before, it deserves the RTBC status.

@srishti.bankar, great work, thank you!

svenryen’s picture

Status: Reviewed & tested by the community » Fixed

I'll take your word that it works. Committed to the dev branch. Thanks for the contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.