Incorrect Node Counts

Created on 22 December 2023, 11 months ago
Updated 21 February 2024, 9 months ago

I recently heard about this module on the Talking Drupal podcast and then watched the GovCon presentation on YouTube.

So I have a site that was migrated from Drupal 7 to Drupal 10. I installed this module and the Node Count report lists zero nodes for most of my content types. On this local instance of the site I also have the Entity Reports and the Site Audit module installed. Those modules do add up the number of nodes in the content types. For some reason Content Model and Site Documentation doesn't.

I hesitated to create an issue because I don't know if I could replicate this problem with another site, however it does happen on all instances of this particular site.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Report

Created by

πŸ‡ΊπŸ‡ΈUnited States keiserjb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @keiserjb
  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    Hi KeiserJB thank you for reporting this. I will look into it after the new year.

    Is there anything special / different about your nodes? Are you using workflow or anything on them? Are you using revisions? If you look at recent log messages are there any notices or errors when looking at the node count report?

    I am not seeing counts being off on any of my current installs, but this is certainly worth looking into.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    I'll look at it again next week. I don't recall any errors. The report just shows zeros for the counts when they are not supposed to be zero. I made a custom module this afternoon to display the node counts and it was all correct.

    Something very well could have gotten scrambled during the migration. The content types not working were Features in D7 that were unfeaturized and migrated but they seem to work other than this report.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    I've found that if I create new nodes, the new ones show up in the report. The old ones that were migrated do not. Perhaps I can find what is happening and trick the old nodes into resaving correctly.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb
  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    To me that hints that maybe you have revisions turned on but your migration did not create a new revision and only subsequent saves do.

    Using the Views bulk operation module would allow you to bulk save them all, that might slave the problem. My bet is your migration configuration is incomplete and needs to be reworked and then an update migration run.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    If you post your migration yml file here I can take a look and see if I can spot what is going on.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    If it is not something you want public, you can DM it to me in Drupal Slack.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    I did the migration with the UI so there weren't any custom migration files. This might be a weird scenario with the content types being Features in D7 and then migrated.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    I think I found it. The langcode for all of the migrated content was set to und. I discovered that new content was set to en. Changing the database for the langcode table fixes the display. I just wish there was an easier way to update the database.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    That is interesting and may be the cause of the bad counts, though I would think correct node counts should not be language dependent so there still may be something else at play. I will look into the count part soon.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    If the migrated content has not been touched by human editors you could always roll back the migration, the set the language in the migration and run it again.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    Rolling back wasn't really an option. Too much had happened. That being said, I updated all the tables in my database where the langcode was und. Everything works now.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    I am glad this worked out for you with adding the language to the table. I think it surfaced a problem in your migrated data, but I also see that there is a problem with this report and the way it only looks only for the specified default language.
    https://git.drupalcode.org/project/content_model_documentation/-/blame/1...
    It should really look through all languages. So I am leaving this open until I can get that reworked.

  • πŸ‡ΊπŸ‡ΈUnited States keiserjb

    Yes, I agree.

  • First commit to issue fork.
  • Status changed to Needs review 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I just removed the default language from the nid count aggregation. Seems to be providing accurate numbers.

    I'm not sure what other factors need to be considered. I think this way of counting is fine because translated nodes don't have a differen't nid like they used to.

    --

    This site appears to have a mix of und and en content, most likely from a previous migration.

    I recall finding a script or module a while back that went through every table and updated the column, but not sure where that went. Looks like the alternative is to do manual sql queries or use vbo.

    I've encountered other problems from messed up languages before, probably worth cleaning up to avoid hidden issues.

  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    @mortona2k thank you for looking into this. This is a good solution. You are right the counting by language makes no sense with the way translation is happening now in Drupal with them all being the same node.

    I'll pull out the whole language column from the report because now it is misleading. I'll get this merged shortly.

    • swirt β†’ committed 87b5fb05 on 1.0.x
      Issue #3410579 by mortona2k, keiserjb, swirt: Remove language from term...
  • Status changed to Fixed 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States swirt Florida

    I just committed mortona2k's patch and removed language entirely from the node and vocabulary table reports.
    It will go out shortly with 1.0.25

    Thank you @mortona2k for your work on this and keiserjb for raising it.

  • Status changed to Fixed 9 months ago
Production build 0.71.5 2024