Problem/Motivation

We need to provide an upgrade path from 7.x for the core Statistics module.

Remaining Tasks

We need migrations, with tests, to cover:

  • Any variables maintained by Statistics need to be moved into configuration
  • The contents of the node_counter table may need to be migrated
CommentFileSizeAuthor
#58 interdiff-54-58.txt4.16 KBjofitz
#58 interdiff-47-58.txt2.56 KBjofitz
#58 2500521-58.patch12.34 KBjofitz
#54 interdiff-52-54.txt788 bytesjofitz
#54 2500521-54.patch13.59 KBjofitz
#52 interdiff-47-52.txt671 bytesjofitz
#52 2500521-52.patch13.67 KBjofitz
#47 interdiff-46-47.txt1.1 KBjofitz
#47 2500521-47.patch12.16 KBjofitz
#46 interdiff-44-46.txt3.47 KBRytoEX
#46 2500521-46.patch12.91 KBRytoEX
#44 interdiff-42-44.txt4.06 KBRytoEX
#44 interdiff-41-44.txt3.09 KBRytoEX
#44 2500521-44.patch12.96 KBRytoEX
#42 interdiff-41-42.txt992 bytesRytoEX
#42 2500521-42.patch13 KBRytoEX
#41 2500521-41.patch12.95 KBRytoEX
#30 interdiff.txt5.44 KBquietone
#30 2500521-30.patch13.08 KBquietone
#28 interdiff-21-28.txt2.42 KBgaurav.kapoor
#28 2500521-28.patch12.98 KBgaurav.kapoor
#21 2500521-21.patch13.01 KBjofitz
#21 interdiff-18-21.txt3 KBjofitz
#18 2500521-18.patch12.97 KBjofitz
#18 interdiff-15-18.txt10.01 KBjofitz
#15 2500521-15.patch3.68 KBjofitz
#15 interdiff-4-15.txt3.96 KBjofitz
#4 2500521-4-do-not-test.patch3.41 KBhussainweb
#1 2500521-1.patch894 bytesquietone
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quietone’s picture

Status: Active » Needs work
FileSize
894 bytes

Just making a start.

phenaproxima’s picture

@quietone: There is already a migration in progress for the statistics settings (see the child issue), but we do need a migration for the node_counter table, if you're up for it.

quietone’s picture

Yea, I saw that after I posted and I was just leaving for the day. Not sure about node_counter table.

hussainweb’s picture

Status: Needs work » Postponed
Related issues: +#1446932: Improve statistics performance by adding a swappable backend
FileSize
3.41 KB

I started working on this and realized it would be much easier if there was a service backing this. This is currently being handled in #1446932: Improve statistics performance by adding a swappable backend. I am postponing this issue on that and posting a patch I started with. Once that is in, we can continue working on the patch.

quietone’s picture

Issue tags: +migrate-d7-d8

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

Status: Postponed » Active

No longer postponed.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

DamienMcKenna’s picture

Adding the main D7-D8 issue as the parent issue.

DamienMcKenna’s picture

Status: Active » Needs review

Lets nudge testbot to take a look at the patch (I'm sure it'll fail, but it's good to follow the standard process).

phenaproxima’s picture

Assigned: Unassigned » phenaproxima

Self-assigning for review.

phenaproxima’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This is not ready for prime time. Sorry, y'all!

  1. +++ b/core/modules/statistics/migration_templates/d7_statistics_node_counter.yml
    @@ -0,0 +1,19 @@
    +  nid:
    +    plugin: migration
    +    migration: d7_node
    +    source: nid
    

    Two observations here. First, I'm not sure it will work if we just pass d7_node as the migration, seeing as how it has a deriver and encompasses many migrations, one per node type. We should be sure this will look in every d7_node derivative.

    Second, if the migration plugin fails, it will return NULL. We should add an additional process plugin here that skips the row if nid is empty.

  2. +++ b/core/modules/statistics/migration_templates/d7_statistics_node_counter.yml
    @@ -0,0 +1,19 @@
    +migration_dependencies:
    +  required:
    +    - d7_node
    

    Again, we need to be sure this is respecting all d7_node derivatives.

  3. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,85 @@
    +use Drupal\ban\BanIpManagerInterface;
    

    Wat. We're not using this for anything.

  4. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,85 @@
    + * Destination for blocked IP addresses.
    

    No it's not! :)

  5. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,85 @@
    +  /**
    +   * Constructs a BlockedIP object.
    +   *
    +   * @param array $configuration
    +   *  Plugin configuration.
    +   * @param string $plugin_id
    +   *  The plugin ID.
    +   * @param mixed $plugin_definition
    +   *  The plugin definiiton.
    +   * @param \Drupal\migrate\Entity\MigrationInterface $migration
    +   *  The current migration.
    +   */
    +  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
    +    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);
    +  }
    +
    +  /**
    +   * {@inheritdoc}
    +   */
    +  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
    +    return new static(
    +      $configuration,
    +      $plugin_id,
    +      $plugin_definition,
    +      $migration
    +    );
    +  }
    

    I don't think we need any of this; we're not injecting any dependencies that I can see. We probably also don't need ContainerFactoryPluginInterface either, in that case.

  6. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,85 @@
    +      'nid' => $this->t('The nid of the node for these statistics.'),
    

    Should be 'the ID of the node to which these statistics apply'.

  7. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,85 @@
    +  public function import(Row $row, array $old_destination_id_values = array()) {
    +    $nid = $row->getDestinationProperty('nid');
    +    $totalcount = $row->getDestinationProperty('totalcount');
    +    $daycount = $row->getDestinationProperty('daycount');
    +    $timestamp = $row->getDestinationProperty('timestamp');
    +
    +    // @todo Save the statistics.
    

    So...we're not saving anything?

Also, there be no tests in them thar hills.

quietone’s picture

There doesn't seem to be a d6 migration for this. Can that be included here?

jofitz’s picture

FileSize
3.96 KB
3.68 KB

Let's move this on a step.

Done: 3, 4, 5, 6, 7
To do: 1, 2

Still needs tests so no point in running past the testbot.

quietone’s picture

Title: Upgrade path for Statistics 7.x » Upgrade path for Statistics 7.x and 6.x
Issue tags: +migrate-d6-d8

On the last migrate call we thought that d6 and d7 statistics were pretty much the same, so marking this for d6 as well.

Rewted’s picture

I originally noted the loss of statistics during my migration. Can anyone tell me how to copy over the views count directly from the old D6 Database to D8 manually?

jofitz’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
10.01 KB
12.97 KB
  • Extended to also handle D6.
  • Added tests.

I'm still not sure how to address #13.1 & #13.2

Status: Needs review » Needs work

The last submitted patch, 18: 2500521-18.patch, failed testing.

mikeryan’s picture

Two observations here. First, I'm not sure it will work if we just pass d7_node as the migration, seeing as how it has a deriver and encompasses many migrations, one per node type. We should be sure this will look in every d7_node derivative.

Don't have time to dig it up at the moment, but I seem to recall looking at a similar scenario and finding that the derivatives are automatically expanded... somewhere.

jofitz’s picture

Status: Needs work » Needs review
FileSize
3 KB
13.01 KB

Moved NodeCounterTest.php to the correct location.

While debugging through the code I can confirm that it does 'magically' expand the derivatives, but don't ask me why/how!

heddn’s picture

Issue tags: +Needs manual testing

Not necessarily critical if someone can dig up where the derivatives get expanded, but another way to prove this is by running a manual test. Tagging and marking Novice. To test this, attempt to migrate d6 of d7 statistics data into D8 and see if the numbers for nodes come over correctly.

heddn’s picture

Issue tags: +Novice

*Now* adding the novice tag.

dexter42’s picture

dexter42’s picture

Hi... one note - when there are translated nodes (e.g. English and German), there are two nodes in D6, but only one node in D8. I assume the statistics have to be summed up.

dexter42’s picture

Btw, in the destination plugin in import function should be following return statement:

return [$row->getDestinationProperty('nid')];

otherwise such row will be marked as failure.... As I have in the meantime this patch heavily customized to make workaround for my translations, I am unable to provide patch.

phenaproxima’s picture

Status: Needs review » Needs work

Looks damn near perfect to me. Just a few nits and it's RTBC once my and @dexter42's comments are addressed.

  1. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,99 @@
    +  public function import(Row $row, array $old_destination_id_values = array()) {
    

    $old_destination_id_values should be [], not array().

  2. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,99 @@
    +      ->fields([
    +        'nid',
    +        'daycount',
    +        'totalcount',
    +        'timestamp',
    +      ], [
    +        $row->getDestinationProperty('nid'),
    +        $row->getDestinationProperty('daycount'),
    +        $row->getDestinationProperty('totalcount'),
    +        $row->getDestinationProperty('timestamp'),
    +      ])
    

    I think I'd rather this were passed as a single associative array, where the database columns are the keys.

  3. +++ b/core/modules/statistics/src/Plugin/migrate/source/NodeCounter.php
    @@ -0,0 +1,43 @@
    + * @MigrateSource(
    + *   id = "node_counter",
    + * )
    

    Should a source provider maybe be mentioned here?

  4. +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php
    @@ -0,0 +1,76 @@
    + * Upgrade node counter.
    

    Should say "Tests the migration of node counter data to Drupal 8."

  5. +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php
    @@ -0,0 +1,76 @@
    +    /** @var StatisticsViewsResult $statistics */
    

    This class name should be fully qualified, which means we can drop the use statement at the top of the file.

  6. +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php
    @@ -0,0 +1,72 @@
    + * Upgrade node counter.
    

    Should be rephrased as "Tests the migration of node counter data to Drupal 8."

  7. +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php
    @@ -0,0 +1,72 @@
    +    /** @var StatisticsViewsResult $statistics */
    

    This should be fully qualified, dropping the use statement at the top of the file.

  8. +++ b/core/modules/statistics/tests/src/Kernel/Plugin/migrate/source/NodeCounterTest.php
    @@ -0,0 +1,66 @@
    + * @covers \Drupal\statistics\Plugin\migrate\source\NodeCounter
    + * @group statistics
    

    I believe the coding standards require an empty line between these two annotations.

gaurav.kapoor’s picture

Status: Needs work » Needs review
FileSize
12.98 KB
2.42 KB

Fixed 27.1,27.4,27.5,27.6,27.7 and 27.8.

phenaproxima’s picture

Status: Needs review » Needs work

Thanks, @gaurav.kapoor! Looks good. I'm returning this to NW until the rest of the points are addressed, but it's definitely getting there.

#28.5 and #28.7 are not quite done yet -- the class name in the comment must be the fully qualified class name. So,

/** @var StatisticsViewsResult $statistics */

needs to be changed to:

/** @var \Drupal\statistics\StatisticsViewsResult $statistics */

quietone’s picture

Status: Needs work » Needs review
FileSize
13.08 KB
5.44 KB

Thanks all. Just some little bits left to do.

Fixed 27.2, 27.3, 27.5, 27.7 and #26. Also, I was getting schema errors when running the migration tests something about node.article.menu_ui. Adding 'menu_ui' to the list of modules fixed that. I think that is everything.

Status: Needs review » Needs work

The last submitted patch, 30: 2500521-30.patch, failed testing.

quietone’s picture

Status: Needs work » Postponed
Related issues: +#2569805: For Drupal migration, identify the source module
exception: [Notice] Line 1054 of core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php:
Undefined index: d6_statistics_node_counter

And the same for D7.

This is failing because the new migrations have not been added to the big array of migrations in MigrateUpgradeForm. That array is being removed in #2569805: For Drupal migration, identify the source module. We could reroll here, but then we need to reroll there. No fun in that. So, I am going postpone this on that issue, which will solve the problem of having to maintain that large array of migrations.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

RytoEX’s picture

Since #2569805: For Drupal migration, identify the source module has been fixed, should this be shifted back to Needs Work for a reroll? I'm not familiar enough with the patch/issue to reroll this myself.

quietone’s picture

Status: Postponed » Needs work
Issue tags: -Novice +Needs reroll

@RytoEX, yea, needs a reroll. But most of the files are new, so it will probably be the test fixture. Yes, just checked it is the test fixture and that can be tricky to reroll, it is a dump of the database prepared with the db-tools in core/scripts. However, it is just adding tables so might be straight forward. Don't know. Want to try?

Still, removing the novice tag because the test fixture is involved. And setting to NW

@RytoEX, thanks!

RytoEX’s picture

If it's just adding tables from a generated dump, I can try to take a look. Any hints on how to properly prepare and dump the database?

quietone’s picture

There are some notes in the handbook, Generating database fixtures for D8 Migrate tests that should help. If you find errors or think it needs improvement, please edit that page. Good luck.

quietone’s picture

Assigned: phenaproxima » Unassigned

Oh, I think it is safe to unassign phenaproxima, He assigned himself to review (#12) and did the review in #13.

RytoEX’s picture

I forgot to ask. Should this be rerolled against 8.4.x or 8.5.x? This issue currently states 8.4.x, but I thought I'd check while I'm still tinkering.

I did finally get the database dumps working. Now I'm trying to reconcile the dumps with the patch from #30.

quietone’s picture

Let's stay with 8.4.x.

Congratulations on getting the dump working. It is an extra part (i.e. hurdle) to working on migrate issues. I find that making the interdiff with a dump involved better results are obtained with 'git diff' instead of 'interdiff patchA patchB'.

RytoEX’s picture

@quietone
After staring at this for way too long, I think I might be overthinking it. I've tried rerolling the patch for 8.4.x, and the individual tests introduced in this patch seem to pass locally, so I'm uploading it. If it's wrong, I'm sure someone will catch it and say something or correct it. I figure it's probably better to try to move forward than for me to keep staring at it wondering if it's correct. If the tests are supposed to be rewritten to use the node_counter values introduced by #2872660: Migrate D6 node reference fields to D8 entity reference field definitions (commit 5380355) and #2669030: D6 Forum vocabulary is migrated to the wrong D8 field name (commit 31b67bb) instead of this patch inserting its own values (as it does here and previously did), say the word. If I've completely missed the mark, I hope to learn where I went wrong.

I couldn't figure out how to make a proper interdiff since the previous patch currently fails to apply on 8.4.x.

Also, I did make a few changes to the documentation page that you'd linked on generating database fixtures.

RytoEX’s picture

I think the failures in #41 are partially due to #2569805: For Drupal migration, identify the source module, so I've made adjustments to deal with that. I've attached a new patch and an interdiff between the new patch and #41. This seems to fix at least a few of the test failures on my end.

Seeing "Source module found for d6_statistics_node_counter." when the test failed seemed a bit odd. I thought it would say "not found", but I may be unaware of some paradigm for test messages.

Again, feel free to wave me off if I've made a blunder.

RytoEX’s picture

#42 seems to have passed all tests. I noted some coding standards issues after the tests, and I have fixed those locally. To fully comply with #2569805: For Drupal migration, identify the source module and its change record (and prepare for #2908282: Throw exception for source plugins without a source_module property and its follow-ups), do we also need to include source_module and destination_module in the annotations for the NodeCounter source and destination classes? Again, assuming I haven't gone down the wrong path with the reroll in the first place.

RytoEX’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
12.96 KB
3.09 KB
4.06 KB

I've updated the patch to fix the Coding Standards issues and adds the source_module and destination_module annotations that I mentioned in #42. From what I can tell, the correct way to specify those for this case is in annotations instead of in a YAML file. I've attached interdiffs against #41 and #42.

Changing status to Needs Review and removing the Needs Reroll tag. I forgot to do these previously.

phenaproxima’s picture

Version: 8.4.x-dev » 8.5.x-dev
Status: Needs review » Needs work
Issue tags: -Needs manual testing

Looks very good. Really nice work -- I see nothing overly wrong here!

  1. +++ b/core/modules/migrate_drupal/tests/fixtures/drupal6.php
    --- /dev/null
    +++ b/core/modules/statistics/migration_templates/d6_statistics_node_counter.yml
    

    Core migrations must now live in the migrations directory, not migration_templates.

  2. +++ b/core/modules/statistics/migration_templates/d6_statistics_node_counter.yml
    @@ -0,0 +1,23 @@
    +id: d6_statistics_node_counter
    

    I think we could combine the d6_statistics_node_counter and d7_statistics_node_counter migrations into a single one. All we'd need to do is:

    1. The 'migration' parameter for the nid lookup needs to be [d6_node, d7_node].
    2. The migration dependencies should be optional, not required, and list both d6_node and d7_node.
    3. Tag the migration with both 'Drupal 6' and 'Drupal 7'.

    If this is insane, then we don't need to do it. Just suggesting it.

  3. +++ b/core/modules/statistics/migration_templates/d6_statistics_node_counter.yml
    @@ -0,0 +1,23 @@
    +      plugin: migration
    

    The 'migration' plugin is now 'migration_lookup'.

  4. +++ b/core/modules/statistics/src/Plugin/migrate/destination/NodeCounter.php
    @@ -0,0 +1,96 @@
    +    $this->connection
    +      ->insert('node_counter')
    +      ->fields([
    +        'nid' => $row->getDestinationProperty('nid'),
    +        'daycount' => $row->getDestinationProperty('daycount'),
    +        'totalcount' => $row->getDestinationProperty('totalcount'),
    +        'timestamp' => $row->getDestinationProperty('timestamp'),
    +      ])
    +      ->execute();
    

    Does Statistics provide a service, or API function, we could use for this? Rather than directly writing to the database? If so, that'd be preferable.

  5. +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d6/MigrateNodeCounterTest.php
    @@ -0,0 +1,76 @@
    +    $this->assertEquals($total_count, $statistics->getTotalCount());
    +    $this->assertEquals($day_count, $statistics->getDayCount());
    +    $this->assertEquals($timestamp, $statistics->getTimestamp());
    

    Let's use assertSame() here instead.

  6. +++ b/core/modules/statistics/tests/src/Kernel/Migrate/d7/MigrateNodeCounterTest.php
    @@ -0,0 +1,72 @@
    +    $this->assertEquals($total_count, $statistics->getTotalCount());
    +    $this->assertEquals($day_count, $statistics->getDayCount());
    +    $this->assertEquals($timestamp, $statistics->getTimestamp());
    

    Same here.

RytoEX’s picture

This new patch is now based against 8.5.x and addresses 45.1, 45.3, 45.5, and 45.6.

I'll let someone else weigh in on 45.2.

I didn't see anything in Statistics that could be used for 45.4 other than recordView, but that seems to use some expression logic for tracking node views, so I'm not sure how compatible it is with the needs here.

jofitz’s picture

Status: Needs work » Needs review
FileSize
12.16 KB
1.1 KB

Addressed 45.2.

I agree with @RytoEX about 45.4.

The 2 test failures in #46 (and retained in this patch too) are due to the changes suggested in 45.5 and 45.6: despite the doxygen, getTotalCount() etc return strings not integers hence why assertEquals() passed, but assertSame() fails. @phenaproxima I would be interested to hear your opinion on the best solution to this? The options include: simply making the expected values strings or editing the StatisticsViewsResult class so that it's values must be integers (e.g. typecasting in the constructor).

Once we iron out the finer points of 45.5 and 45.6, which should be simple enough, this will be ready for RTBC.

Status: Needs review » Needs work

The last submitted patch, 47: 2500521-47.patch, failed testing. View results

RytoEX’s picture

Status: Needs work » Needs review

The interdiff in #47 omits the new file core/modules/statistics/migrations/statistics_node_counter.yml made to address 45.2, just in case anyone was only checking interdiffs.

I would also be curious to know more about the test messages that I mentioned in #42, but that may need to be left for a follow-up issue, if there is anything to address at all. My initial feeling about them is that the messages are incorrect, and that they should say "module not found" when the assertion fails rather than "module found".

phenaproxima’s picture

Status: Needs review » Needs work

@phenaproxima I would be interested to hear your opinion on the best solution to this?

Counts are integers by definition. It makes no sense for a count of any kind to be a string -- the inconsistency is usually due to PHP's loose typing rules, and the database drivers not bothering to cast return values, since they don't necessarily have any idea what type of data is contained in various columns.

So, if we're dealing with counts, we should always cast them to integers, and use assertSame().

phenaproxima’s picture

My initial feeling about them is that the messages are incorrect, and that they should say "module not found" when the assertion fails rather than "module found".

My understanding, which may be inaccurate, is that they can be either. They're only displayed if an assertion fails anyway. So if the message is positive, you'll know what failed; and, if it's negative, you'll know what failed. It's just a difference of phrasing -- your choice! :)

jofitz’s picture

Status: Needs work » Needs review
FileSize
13.67 KB
671 bytes

I have cast the values to integer in the StatisticsViewsResult constructor.

Status: Needs review » Needs work

The last submitted patch, 52: 2500521-52.patch, failed testing. View results

jofitz’s picture

Status: Needs work » Needs review
FileSize
13.59 KB
788 bytes

Correct the test failure to expect an integer rather than a string (and remove the interdiff that I managed to include in the patch!)

heddn’s picture

Status: Needs review » Reviewed & tested by the community

All feedback addressed. Onward and upward.

xjm’s picture

Priority: Minor » Normal
phenaproxima’s picture

Status: Reviewed & tested by the community » Needs work

Really looking fantastic. Only a couple more points, then this is completely ready to go.

  1. +++ b/core/modules/statistics/migrations/statistics_node_counter.yml
    @@ -0,0 +1,25 @@
    +label: Drupal 6 Node Counter
    

    Since this migration is generic for D6 and D7, it should probably just be "Node counter".

  2. +++ b/core/modules/statistics/src/StatisticsViewsResult.php
    @@ -23,9 +23,9 @@ class StatisticsViewsResult {
       public function __construct($total_count, $day_count, $timestamp) {
    -    $this->totalCount = $total_count;
    -    $this->dayCount = $day_count;
    -    $this->timestamp = $timestamp;
    +    $this->totalCount = (int) $total_count;
    +    $this->dayCount = (int) $day_count;
    +    $this->timestamp = (int) $timestamp;
    

    This is out of scope. I know we need to do it in order to get our tests to pass, but I think we can simply cast the value *in the tests*, rather than here. Let's revert this part of the patch, then open separate follow-up to make this fix in Statistics by itself.

jofitz’s picture

Status: Needs work » Needs review
FileSize
12.34 KB
2.56 KB
4.16 KB

I did wonder if I was wandering down the wrong path!

  1. Corrected the Node Counter label.
  2. Removed the out-of-scope changes and cast the values in the tests (created a follow-up to fix StatisticsViewsResult: #2926069: StatisticsViewsResult should only deal in integer values).
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

Nice one. Thanks everybody!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 58: 2500521-58.patch, failed testing. View results

RytoEX’s picture

Status: Needs work » Reviewed & tested by the community

Patch had failed testing for some reason (Aggregator?). Re-ran the tests and everything passed. Back to RTBC per #59.

  • catch committed eca600b on 8.5.x
    Issue #2500521 by Jo Fitzgerald, RytoEX, quietone, gaurav.kapoor,...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed eca600b and pushed to 8.5.x. Thanks!

ao2’s picture

Thanks, this works pretty well here too, after adjusting the migration lookup to my custom migrations.

As @dexter42 pointed out in #25, the node_counter table only knows about node ids and so if the D6 nodes have translations with the current patch the statistics of the translations are lost when migrating to D8.

Not a big deal in my case as I have very few translations but worth mentioning IMHO.

Summing up the statistics of all the nodes in a translation set would be ideal, but it's probably more work than it's worth it.

Ciao,
Antonio

heddn’s picture

Re #64: can we get a follow-up opened to address the i18n aspect there?

masipila’s picture

Did this commit cover all the aspects that are cjrrently mentioned on the Known Issues page i.e. can we remove the section for Statistics on that handbook page? https://www.drupal.org/docs/8/upgrade/known-issues-when-upgrading-from-d...

masipila’s picture

Status: Fixed » Closed (fixed)

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