Actions

Difference between revisions of "Developer Area/Plugins"

From Mahara Wiki

< Developer Area
(Remove plugin)
 
(11 intermediate revisions by 8 users not shown)
Line 2: Line 2:
  
 
Mahara has a highly pluggable architecture. Currently, you can write plugins for authentication, content types (artefacts), blocks, notifications, search and more. In addition, you can [[Customising/Themes|theme Mahara]], and also [[Developer Area/Language Packs|translate the UI to different languages]].
 
Mahara has a highly pluggable architecture. Currently, you can write plugins for authentication, content types (artefacts), blocks, notifications, search and more. In addition, you can [[Customising/Themes|theme Mahara]], and also [[Developer Area/Language Packs|translate the UI to different languages]].
 +
 +
=== Third party plugins within Mahara system ===
 +
 +
Mahara, being open source, relies on a number of other open source plugins for certain parts of its functionality. To check what plugins are being used you can look at the [[Developer Area/Plugins/Third party|Third party plugin list]], or run this command from base install directory to find their version number.
 +
 +
find ./ -iname readme.mahara -exec grep -H 'Version' {} \;
 +
 +
=== Developer Documentation ===
  
 
* The [[Developer Area/Mahara Architecture Introduction|Mahara Architecture Introduction]] series of articles gives you a general introduction to how Mahara is structured, and where plugins can go and what they can do.
 
* The [[Developer Area/Mahara Architecture Introduction|Mahara Architecture Introduction]] series of articles gives you a general introduction to how Mahara is structured, and where plugins can go and what they can do.
* [[Developer Area/Plugin migration between Mahara 1.3 and 1.4|Plugin migration between Mahara 1.3 and 1.4]} Notes to help upgrade (or backport) Mahara plugins
+
* [[Developer Area/Plugin migration between Mahara 1.3 and 1.4|Plugin migration between Mahara 1.3 and 1.4]] Notes to help upgrade or backport Mahara plugins
 +
* [http://mahara.org/view/view.php?id=39443 Tutorial for creating a Mahara blocktype plugin]
 +
* [https://mahara.hrz.tu-darmstadt.de/view/view.php?id=5259 Artefact plugin template] by Angela Karl
 +
 
 +
If you want to include third-party code as a part of your plugin, please verify that that code is compatible with GPL v3, which is the license that the Mahara is licensed under.
 +
 
 +
You can verify license compatibility using the following references:
 +
 
 +
*[http://fedoraproject.org/wiki/Licensing:Main#Software_License_List Fedora Project - Software License List]
 +
*[https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses GNU GPL-Compatible Free Software Licenses]
 +
 
 +
=== Remove a plugin ===
 +
 
 +
Currently there is no automated system to remove a plugin. But following these steps should get a thirdparty plugin removed.
 +
1) Check if the plugin has an install.xml file and if so make a note of any custom tables it has added
 +
2) Delete the related rows from the database. This will be specific to the plugin type.
 +
- Begin by trying to delete the row in the [plugin]_installed table
 +
-- which should complain about foreign key issues so you need to delete those rows first
 +
-- if they complain about foreign key issues you will need to delete those rows first, etc.
 +
 
 +
For example if you are wanting to delete the 'cpds' plugin, which has both a block and artefact component, you can use the following SQL commands (written for Postgres but if doing for Mysql the resourceid::int will just be resourceid).
 +
 
 +
  --- deleting tags ---
 +
  delete from tag where resourcetype = 'artefact' and resourceid::int in (select id from artefact where artefacttype in (select name from artefact_installed_type where plugin = 'cpds'));
 +
  delete from tag where resourcetype = 'artefact' and resourceid::int in (select id from block_instance where blocktype = 'cpds');
 +
 
 +
  --- deleting view/artefact connections ---
 +
  delete from view_artefact where artefact in (select id from artefact where artefacttype in (select name from artefact_installed_type where plugin = 'cpds'));
 +
 
 +
  --- delete any custom table info ---
 +
  delete from artefact_cpds_activity;
 +
 
 +
  --- deleting blocks ---
 +
  delete from block_instance_dimension where block in (select id from block_instance where blocktype = 'cpds');
 +
  delete from blocktype_installed_category where blocktype = 'cpds';
 +
  delete from blocktype_installed_viewtype where blocktype = 'cpds';
 +
  delete from block_instance where blocktype = 'cpds';
 +
  delete from blocktype_installed where name = 'cpds';
 +
 
 +
  --- deleting artefacts ---
 +
  delete from artefact where artefacttype in (select name from artefact_installed_type where plugin = 'cpds');
 +
  delete from artefact_installed_type where plugin = 'cpds';
 +
  delete from artefact_installed where name = 'cpds';
 +
 +
3) Delete the plugin's directory
 +
 
 +
=== Admin stuff ===
 +
 
 +
We used to maintain a "mahara-contrib" project in Gitorious and Launchpad, where we invited plugin developers to keep their projects. This fell into disuse circa 2010, and now we encourage plugin developers to host their project wherever they wish, and we'll link to it on our [[Plugins]] page.
 +
 
 +
* (Obsolete) [[Developer Area/Creating a new project|Creating a new project]]
 +
 
 +
[[Category:Plugins]]

Latest revision as of 09:04, 6 May 2020

Note: If you are looking for plugins to download, you can browse a list of them at http://wiki.mahara.org/Plugins

Mahara has a highly pluggable architecture. Currently, you can write plugins for authentication, content types (artefacts), blocks, notifications, search and more. In addition, you can theme Mahara, and also translate the UI to different languages.

Third party plugins within Mahara system

Mahara, being open source, relies on a number of other open source plugins for certain parts of its functionality. To check what plugins are being used you can look at the Third party plugin list, or run this command from base install directory to find their version number.

find ./ -iname readme.mahara -exec grep -H 'Version' {} \;

Developer Documentation

If you want to include third-party code as a part of your plugin, please verify that that code is compatible with GPL v3, which is the license that the Mahara is licensed under.

You can verify license compatibility using the following references:

Remove a plugin

Currently there is no automated system to remove a plugin. But following these steps should get a thirdparty plugin removed. 1) Check if the plugin has an install.xml file and if so make a note of any custom tables it has added 2) Delete the related rows from the database. This will be specific to the plugin type. - Begin by trying to delete the row in the [plugin]_installed table -- which should complain about foreign key issues so you need to delete those rows first -- if they complain about foreign key issues you will need to delete those rows first, etc.

For example if you are wanting to delete the 'cpds' plugin, which has both a block and artefact component, you can use the following SQL commands (written for Postgres but if doing for Mysql the resourceid::int will just be resourceid).

 --- deleting tags ---
 delete from tag where resourcetype = 'artefact' and resourceid::int in (select id from artefact where artefacttype in (select name from artefact_installed_type where plugin = 'cpds'));
 delete from tag where resourcetype = 'artefact' and resourceid::int in (select id from block_instance where blocktype = 'cpds');
 --- deleting view/artefact connections ---
 delete from view_artefact where artefact in (select id from artefact where artefacttype in (select name from artefact_installed_type where plugin = 'cpds'));
 --- delete any custom table info ---
 delete from artefact_cpds_activity;
 --- deleting blocks ---
 delete from block_instance_dimension where block in (select id from block_instance where blocktype = 'cpds');
 delete from blocktype_installed_category where blocktype = 'cpds';
 delete from blocktype_installed_viewtype where blocktype = 'cpds';
 delete from block_instance where blocktype = 'cpds';
 delete from blocktype_installed where name = 'cpds';
 --- deleting artefacts ---
 delete from artefact where artefacttype in (select name from artefact_installed_type where plugin = 'cpds');
 delete from artefact_installed_type where plugin = 'cpds';
 delete from artefact_installed where name = 'cpds';

3) Delete the plugin's directory

Admin stuff

We used to maintain a "mahara-contrib" project in Gitorious and Launchpad, where we invited plugin developers to keep their projects. This fell into disuse circa 2010, and now we encourage plugin developers to host their project wherever they wish, and we'll link to it on our Plugins page.