Wishlist: Generic plugin type

Bug #1328768 reported by Aaron Wells on 2014-06-11
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Aaron Wells

Bug Description

It would be useful to have a generic plugin type that provides all the benefits of every plugin type (i.e. lang strings, templates, cron jobs, config screens, config table, etc), while not having any specific functionality tied to it. This would be useful for:

1. Encouraging encapsulation of core code, especially for components that are mostly standalone, like the new "chat" functionality.

2. Third-party distributed code that doesn't match any of the existing plugin types. (Although really, we should just have a "local" plugin type for these.)

Aaron Wells (u-aaronw) wrote :

We were discussing this on the IRC channel. I've decided to call the new plugintype "module", because the plugintype shows up in the URL so we need it to be something nice and generic. Here's a discussion from Simon that summarizes the results of our discussion:

<simoncoggins> so the summary is:
<simoncoggins> 1. Some bits of core code can be isolated into a plugin
<simoncoggins> 2. This is generally a good idea to keep related code together
<simoncoggins> 3. Not all plugins fit within the existing types
<simoncoggins> 4. Therefore it would be good to have a generic plugin type
<simoncoggins> 5. It would be good if it was specific to the distribution to avoid clashing with 3rd party modules
<simoncoggins> 6. The name will be in the url therefore should be generic/not too messy
<simoncoggins> 7. Therefore module/ for core code, and possibly local/ for 3rd party stuff

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/3435

Aaron Wells (u-aaronw) wrote :

Okay, I pushed a patch that creates the "module" plugintype. It turns out that to create a basic plugintype, all you have to do is:

1. Alter the plugin_types() method in mahara.php
2. Create the directory and the lib.php file, with a Plugin subclass.
3. For it to handle dwoo templates you also need to create a Dwoo_Mahara_Template subclass.

... well actually you don't need to do #3 anymore, because of some refactoring of the Dwoo_Mahara_Template class which I pushed for Bug 1231755.

While I was it I did some cleanup of the base Plugin class as well, which is why there are two patches.

Aaron Wells (u-aaronw) wrote :

Attaching a sample "module" plugin I used during testing. It shows off most of the things a plugin can do:

 - install.xml
 - post-installation method
 - config storage
 - admin config screen
 - cron job
 - sanity check
 - dwoo templates

Reviewed: https://reviews.mahara.org/3435
Committed: http://gitorious.org/mahara/mahara/commit/6c89ad48fbe36c431528d9e5bc9715279b043b3e
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 6c89ad48fbe36c431528d9e5bc9715279b043b3e
Author: Aaron Wells <email address hidden>
Date: Wed Jun 11 20:07:00 2014 +1200

Cleanup of the Plugin class

Bug 1328768

- Improving documentation

- Adding default implementations for the *_config_options methods because
that's a better means of documenting them than the function_exists() way

- Fixing the save_config_options() methods in the search plugins, which
should have been static.

Change-Id: Ib2bf1388843824e63cf6486176e97b8f874e1116
Signed-off-by: Yuliya Bozhko <email address hidden>

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3436
Committed: http://gitorious.org/mahara/mahara/commit/7d1f73b8b23bf98b49af3bcf76ba3f35aacedf48
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 7d1f73b8b23bf98b49af3bcf76ba3f35aacedf48
Author: Aaron Wells <email address hidden>
Date: Wed Jun 11 18:07:49 2014 +1200

Creating plugintype "module" for miscellaneous plugins

Bug 1328768: A new generic plugintype for any plugins that don't fit other types

Change-Id: I706241d73947805a5d3f8d623c4bc8dc0d94429b

tags: added: nominatedfeature
Changed in mahara:
status: In Progress → Fix Committed
Aaron Wells (u-aaronw) on 2014-10-21
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers