Move multiple provider plugin work from migrate into core's plugin system

Created on 18 August 2016, over 8 years ago
Updated 28 April 2025, 1 day ago
πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component

plugin system

Created by

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

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

  • First commit to issue fork.
  • Pipeline finished with Failed
    1 day ago
    Total: 405s
    #483444
  • With the move to discovery by attributes, dealing with multiple "providers" generally was necessitated since discovery uses reflection and PHP has to parse the class files. With missing providers, this can result in exceptions and/or fatal errors, and this has largely been handled by πŸ“Œ Add a fallback classloader that can handle missing traits Active . Remaining part to do for attribute discovery is to filter out plugin definitions that were cached in APCu filecache when the providers (modules) were previously installed but now aren't.

    Put up MR with some of this work pulled from attempts in other issues to see what tests pass. Will revisit and address failing tests and check for any outstanding issues later when time permits.

    Annotation discovery will be left intact with multiple providers until it is ultimately deprecated and removed.

  • Pipeline finished with Failed
    1 day ago
    Total: 564s
    #483576
  • Pipeline finished with Failed
    1 day ago
    #483592
  • Pipeline finished with Failed
    about 18 hours ago
    Total: 279s
    #484111
  • Pipeline finished with Failed
    about 18 hours ago
    Total: 152s
    #484116
  • Pipeline finished with Success
    about 18 hours ago
    Total: 945s
    #484119
  • OK, got all existing tests passing.

    Quick summary of work done here (will update the IS later when I'm less tired):
    I ran with the idea of plugins (via attribute discovery) having "dependencies" instead of multiple providers as first mentioned in #8. This led to introducing new methods on the plugin system's AttributeInterface and AttributeBase to get and set the dependencies.

    Because there's an existing division between Component AttributeClassDiscovery and Core AttributeClassDiscovery, in that the core class handles the concept of "providers", I split dependency detection between the two. So the dependencies found in the component discovery class are the names of classes, interfaces, and traits in the plugin class's hierarchy. Then in the core discovery class, the providers for classes, interfaces, and traits are derived. The end result is that plugins that have missing provider dependencies (in other words, they rely on assets in uninstalled modules) will be excluded from discovery unless the providers are installed. Keeping track of the classes/traits/interfaces also allows for the flexibility to handle if a plugin class has a non-Drupal class in its hierarchy that is optionally in the codebase. This is not checked now, to avoid having to load classes into memory to check, but it could be done if needed.

    The methods on the Attribute class to get/set dependencies makes the dependency information available within its definition for processes that need it, such as migrate_drupal detecting whether a plugin has a dependency on it before requiring a source_module property.

    Remaining to do:

    • A test that confirms that installing a module causes plugins that have a dependency on it to be discovered (I actually think this exists), but then after that, uninstalling the module then removes the plugin from discovery
Production build 0.71.5 2024