Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension Dependency Management Revamp #2093

Closed
askvortsov1 opened this issue Mar 28, 2020 · 1 comment
Closed

Extension Dependency Management Revamp #2093

askvortsov1 opened this issue Mar 28, 2020 · 1 comment
Assignees

Comments

@askvortsov1
Copy link
Sponsor Member

Functionality Discussion

Related Discussions:
#1318
#1039

Is your feature request related to a problem? Please describe.
Flarum assumes that if an extension installs, everything is perfectly fine with it. Additionally, it loads extensions in the order they were enabled. Neither of these are particularly robust. IMO, the following issues should be fixed:

  1. If an extension depends on another flarum extension, it should not be enable-able until its flarum dependencies are enabled.
  2. If an extension has flarum extensions depending on it, it should not be disable-able until its flarum dependencies are disabled
  3. If, during app boot, an enabled extension has a missing flarum dependency, it should not be loaded, and should be marked as disabled (this will not result in an inconsistent state as we don't even TRY to load it).
  4. Enabled extensions should be loaded in such an order that an extension is loaded AFTER its enabled dependencies have been loaded.
  5. Required PHP versions and php extension versions should be obeyed before loading extensions.

Describe the solution you'd like
One way that has been proposed is getting dependencies from the composer.json file. I don't like this for several reasons:

  1. It assumes that the extension is 'compiled' (well more like assembled) on the same machine/environment that the forum is running on.
  2. It assumes that an extension is dependent on all flarum extensions it lists in requires. I have written extensions that 'require' other extensions while not actually depending on their functionality.
  3. The composer.json require list does NOT indicate whether something is a flarum extension. This means that during load, we would need to open and check the composer.json file of every single package required by an extension to make a list of flarum extensions that extension depends on
  4. This further ties us to composer, in a manner where I don't think that's necessary.

I would like to propose that we build in our own method for dependency management. In addition to the extend.php file, we require a flarum-dependencies.php (or flarum-dependencies.json) file, which would list:

  • PHP version requirements
  • PHP extension dependencies and version requirements.
  • Flarum extension dependencies and version requirements.
  • Flarum extension conflicts and version requirements.

If any of these are omitted, they would be ignored.

This would give us a LOT more robustness in our extension management system.

@franzliedke franzliedke added this to the 0.2 milestone Apr 13, 2020
@askvortsov1 askvortsov1 self-assigned this May 27, 2020
@askvortsov1
Copy link
Sponsor Member Author

Closing in favor of #1318, we can revisit this if we decide that we want to do runtime dependency checks.

@askvortsov1 askvortsov1 removed this from the 0.2 milestone Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants