Currently, in the metadata.json, there is following feild:
"load_order": "after_db_init" or "load_order": "before_db_init"
which indicates, when should load this plugin - is it before db initialisation or after db initialisation.
Let's assume following situation:
if pluginA defined a function F, and pluginB needs to use that function. That means PluginB is depends upon pluginA. However, there is no way in the current q2a, to define this dependency level.
So, we have two options:
- PluginA needs to be loaded before pluginB - This is based on the names of the plugins and order is not correctly predicted.
- Redeclare the same function with similar logic - this will leads to inconsistency if pluginA modified the function F.
To avoid this, I have added following feild in the metadata.json
"dependency_level": 2, - which indicates, the loading level of plugin. (Lower the dependency number, loads earlier.)
Hence, first all the dependency_level=1 plugins will be loaded, after that dependency_level=2 plugins will be loaded.
The code fix is available at https://github.com/q2a/question2answer/pull/1011/commits/182041865f7003f20d4e8c64d1d82ce7a5f7b7bc