-
-
Notifications
You must be signed in to change notification settings - Fork 834
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
Allow optional dependency / one-of-several dependency requirements to control extension boot order #1318
Comments
Isn't this what |
IMO this is fine as long as extensions are enabled in the proper order (which is a larger issue I feel). I'd propose handling this by adding in a check when enabling an extension that all its dependencies are enabled, and when disabling an extension that there isn't anything dependent on it enabled. Thoughts? |
Can LifecycleHooks have a mechanism that allows extensions to be loaded before or after other extensions? Eg: class LoadingSequence implements LifecycleHook
{
public function before(): ?array {
return ['flarum-tags', 'fof-upload'];
}
public function after(): ?array {
return ['flarum-flags', 'fof-byobu'];
}
} |
I was thinking of doing it directly through composer reqs, but doing it explicitly like this might be a good idea too. Both have merits, not sure which is preferable |
A few more thoughts:
To that end, I would propose that we add a "optionalDependencies" key to the flarum-specific config, which would be an array of extension IDs. We would then modify the However, this only solves optional dependencies, not "one-of-some" dependencies (a "one-of-some" dependency could be https://github.com/Xelson/flarum-ext-chat depending on either pusher or websockets). SInce there are several options, they can't be included in |
I would be in favour of using an
While I haven't used it before myself, this might be solvable by using virtual packages in composer: https://getcomposer.org/doc/04-schema.md#provide Example of a package using this: https://packagist.org/packages/symfony/cache So I think pusher and websockets would both provide for example |
Ah, and then both could be specified as optional dependencies! As a result:
Brilliant! |
The remaining item here is to add a composer script to |
Currently extensions are booted in the order that they are enabled (in both backend and frontend).
This should be modulated so an extension cannot be booted before any of the extensions it
require
s.The text was updated successfully, but these errors were encountered: