Forums | Mahara Community

Developers /
Dependencies between plugins


Tobias Zeuch's profile picture
Posts: 111

28 March 2014, 3:52

Hi,

is it possible to define dependencies between plugins that say for example that a plugin can only be installed when another plugin already exists or maybe more globally, when a certain blocktype or artefact type exists? 

We have two plugins here where one depends on the other and fails when you try to install it first, but when I do a fresh mahara install, they are installed in the wrong order. 

Thanks

Tobias

Aaron Wells's profile picture
Posts: 896

28 March 2014, 11:35

Hi Tobias,

We don't currently have any API for checking plugin requirements before installing or upgrading them. They just get installed if they're present. And if multiple ones are present, they get installed/upgraded in the plugin type order specified in the plugin_types() function... and I think different plugins of the same type just get installed in arbitrary order? Or maybe it's alphabetical order...

Anyway, for now you'll just need to specify it in the README. :(

This issue of some plugins being dependent on others, has bitten us in the past a few times. So it would be nice to have some kind of plugin requirements option. It could be something that goes in the version.php file, and takes an array where you specify, like "core" => 2013040500 to indicate the required core Mahara version, and "artefact.blog" => 2012040501 to indicate the required version of other plugins.

On a similar note, maybe adding an optional sanity check method for each plugin, which is checked before installing or upgrading. (Like the current core sanity check)

Cheers,

Aaron

Tobias Zeuch's profile picture
Posts: 111

28 March 2014, 20:42

Hi Aaron,

thanks for the reply. I actually like the idea of a sanity check better, way more flexible. You could even check for php-extensions or external programs. Only advantage for the dependence I see right now is that you could try to find an order to install all plugins together with the core system instead of just skipping them. But you might just as well run re-attempts on the failed installations. 

I'll file a bug report and give the sanity check a try. 

Until then I found a dirty workaround: Throwing an InstallationException in $plugindir/lib.php causes the installation to skip this plugin and printing the exception-message onto the screen above the form data - although below in the list the plugin still gets listed as installed. 

About the installation order: That seems to depend on the order in which the folders get back from readdir($dirhandle), which again depends on the OS, so I guess it's usually the order in which the folders were created - so more or less arbitrary

Cheers

Tobias

Tobias Zeuch's profile picture
Posts: 111

28 March 2014, 21:43

The bug report, for the reference: https://bugs.launchpad.net/mahara/+bug/1298855

4 results