Move performant info.yml regex to InfoParser

Created on 4 August 2016, about 9 years ago
Updated 30 August 2025, 23 days ago

Problem/Motivation

Follow-up to #2725839: Remove Drupal\Core\Extension\ExtensionDiscovery::getInfoParser() since it is dead code β†’ which deprecates ExtensionDiscovery::getInfoParser().

getInfoParser() is not needed because ExtensionDiscovery only needs to look at the type key from the info.yml file, so it uses a regex on the file data, rather than parsing the entire file contents.

This behavior should be available to other areas in Drupal, and should also be testable, for issues such as #2318847: ExtensionDiscovery does not allow the value of the "type" key to be wrapped in quotes β†’

Proposed resolution

Add the regex to the InfoParser class as a static method.

Write tests.

Given that InfoParser keeps a static cache of all the files it has fully parsed, this means a potential performance improvement for files which have already been parsed, as a side-effect.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

extension system

Created by

πŸ‡ΊπŸ‡ΈUnited States mile23 Seattle, WA

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

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

    This path has been deprecated we use the full parser but it's cached in the file cache is this worth doing still?

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @nicxvan I'm not sure that this path as been deprecated... we're still doing things like $extension_discovery = new ExtensionDiscovery($this->root, FALSE, []); and passing FALSE to $use_info_parser will cause it to use this code path.

    That said I stand by my comment in #6 ... we should not make this functionality generic so going to close won't fix because there's no been any call for this functionality in the years since this was opened.

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

    You're right! I misread the constructor.

    I'm still happy to close this.

Production build 0.71.5 2024