Error when project name and module name don't match

Created on 3 January 2024, 11 months ago
Updated 14 September 2024, 2 months ago

Problem/Motivation

For these themes and modules projects, the *.info.yml file does not start with the Drupal project name.

  • drupal/govuk_theme => govuk (theme)
  • drupal/jitsi => ek_jitsi (module)

There may be more. in my case It produces this exception and stack trace.

Drupal\Core\Extension\Exception\UnknownExtensionException: The theme govuk_theme does not exist or is not installed. in Drupal\Core\Extension\ExtensionList->getExtensionInfo() (line 346 of core/lib/Drupal/Core/Extension/ExtensionList.php).

composer_deploy_preprocess_update_project_status(Array, 'update_project_status', Array)
call_user_func_array('composer_deploy_preprocess_update_project_status', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('update_project_status', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 161)
__TwigTemplate_e12ddcc3b86a74ab48cb30a3fad67c30->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('themes/custom/theme/templates/layout/table.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('table', Array) (Line: 433)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 479)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 54)
__TwigTemplate_44e51b3ef1de6af5dee9480dae7d4e9b->doDisplay(Array, Array) (Line: 405)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 378)
Twig\Template->display(Array) (Line: 390)
Twig\Template->render(Array) (Line: 55)
twig_render_template('core/modules/update/templates/update-report.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('update_report', Array) (Line: 433)
...

Steps to reproduce

Add one of the above projects at a version below the current one, enable this module and the additional project and visit the update status page.

Proposed resolution

At this moment, this change in composer_deploy.module:82 following works

  if ('govuk_theme' == $variables['project']['name']) {
    $name = 'govuk';
  }
  else {
    $name = $variables['project']['name'];
  }
  $projectData = \Drupal::service('extension.list.' . $project_type)->getExtensionInfo($name);

was

  $projectData = \Drupal::service('extension.list.' . $project_type)->getExtensionInfo($variables['project']['name']);

but that is not sustainable.

Remaining tasks

At this moment I can not find something like the filename, name and type column inormation from the D7 system table to use to match the Drupal project name to a theme or module. There must be something for the Drupal autoloader to work as that maps machine name PHP namespaces to project directories. If someone points me at it I can produce a fork or patch file.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom somersoft

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024