Problem/Motivation

On Drupal 8.9.5, with Upgrade Status 8.x-3.0-alpha1, The link on Varnish Purger module is incorrect on the report list, and also the data in column "DRUPAL.ORG 9-READY" is incorrect.

This is because Varnish Purger project name is "varnish_purge" while the module machine name is "varnish_purger".

I tried in upgrade_status/src/Form/UpgradeStatusForm.php::buildProjectList()

foreach ($projects as $name => $extension) {
      $name = $extension->info['project'];

to test if it was enough. Nope, I guess because the key is used elsewhere, maybe a little everywhere in the module.

Steps to reproduce

Proposed resolution

Rely on the "project" key in the .info.yml file if it exists instead of the machine name.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Grimreaper created an issue. See original summary.

gábor hojtsy’s picture

The project collector is responsible for collating projects. That already has various code pieces to take the project key when available and propagate the project key from https://git.drupalcode.org/project/upgrade_status/-/blob/8.x-3.x/src/Pro... onwards, such as:

      // If the project is already specified in this extension, use that.
      $project = isset($extension->info['project']) ? $extension->info['project'] : '';

      // ....

      // After the collation is done, assign project names based on the topmost
      // extension. While this is not always right for drupal.org projects, this
      // is the best guess we have.
      foreach ($projects as $name => $extension) {
        if (!isset($extension->info['project'])) {
          $projects[$name]->info['project'] = $name;
        }

It may be that when we use the resulting data, we wrongly assume that the projects array is keyed by project name, while we should be looking at the info['project'] key which we even backfill for unidentified projects.

gábor hojtsy’s picture

Status: Active » Needs review
StatusFileSize
new1.63 KB

Does this help? It would be great to have a test module that has a name and project mismatch to ensure this keeps working.

gábor hojtsy’s picture

Title: Use "project" instead of module machine name if possible » The extension machine name is used for links and update checking instead of the project name
grimreaper’s picture

Status: Needs review » Reviewed & tested by the community

Hello,

Thanks for the quick reply!

I confirm that the patch fixes the link on Varnish Purger and the "DRUPAL.ORG 9-READY" column data.

Regards,

gábor hojtsy’s picture

StatusFileSize
new3.55 KB

Added tests for the link at least by adjusting the project name of one of the tested "contrib" projects. Testing for the available updates data woul be much harder, we are not testing that ATM. Added more comments to the code as well to make sure we don't accidentally regress this.

Passed locally.

  • Gábor Hojtsy committed 4aa2200 on 8.x-3.x
    Issue #3169792 by Gábor Hojtsy, Grimreaper: The extension machine name...
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Landed this, thanks for reporting and testing!

grimreaper’s picture

Thanks!

Glad to help!

Cheers,

Status: Fixed » Closed (fixed)

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