Patch #26439

Updated by Toshi MARUYAMA almost 4 years ago

This patch allows for a plugin to delay loading until a set of requirements is met. This could be because I need for other plugin to be loaded first.

The ideia is to to have each plugin check at the top of init.rb for it's requirements and if they are not met to raise Redmine::Plugin::PluginDeferLoadError. This will signal the plugin load logic to try loading this plugin later.

The algorithm prevents infinite looping (by direct or indirect circular dependencies) by loading plugins by iterations. In each iteration amount of plugins to load must be lower.

The most common check made by plugins can be simplified by using at the top of the init.rb this line:

<pre><code class="ruby">

&lt;pre&gt;
Redmine::Plugin.requires_plugin('redmine_plugin_name')
</code></pre> &lt;/pre&gt;

Regards

Back