Development:Modules and plugins replacement proposal
Hi all before you get to excited this document is still under construction. Please bear with me while I create it and refrain from editing it. Also note there is a high chance things will change regually.
Creation of an alternative Modules and plugins database system. This is a design proposal for the system that will be created to replace the Modules and plugins database. Development of this system will be undertaken by Moodle HQ after this proposal has reached maturity.
The initial direction
The new system is to completely replace the current modules and plugins database, as well as the themes database. It has been decided that the new system will be a local plugin within Moodle. This gives us the advantage that we can both make use of the Moodle backend, as well as benefit from already having all of the user accounts, capabailities/permissions, and setup of Moodle.org for when this new system gets implemented. Because of this decision the new system will be making use of the Moodle API's whereever possible, this includes, comments, tags, if possible ratings (some improvements required) and of course the Moodle file API. Integration and reliance on these Moodle components will be documented within this proposal along with the database stucture, and screens that the system will consist of.
The following are the major design focuses for this new system:
- Categorise contributed code
- Categorisation of code based upon the type of the code, and perhaps for unspecific areas such as hacks categorisation based upon the nature of the code as well.
- Track versions of contributed code
- This will allow contributors to maintain multiple versions of thier code, hopefully better supporting the diversity of code between Moodle versions.
- A trusted review system
- A trusted review system consisting of both a general review and criteria based review for versions of contributed code.
- Complete supported version tracking
- Tracking of both major and minor release support by version of contributed code.
- Full support for all types of contributed code
- All native Moodle plugin types including theme's as well as core patches/hacks.
- Improved user interaction
- We hope to get users interacting more with contributors. Providing ratings, commenting, reiviewing, perhaps even contributing themselves.
- Better search
- The ability to easily search for plugins, and plugin versions, comments, and reviews.
- More comprehensive reporting
- Sortable, customisable reports for the an array of things within the new system.
- Notification services and systems
- Choose to be notified when there are new plugins, new versions, new reviews, and changes or any combination of.
- Support for popular version control systems
- Be able to link in to you projects git, cvs, or svn repository.
- Statistics
- Downloads, views, reviews, ratings, activity etc.
- Awards
- There will be awards for plugins that can be used for things such as showing the level of the plugin (gold, silver, bronze), or marking it was a status (featured).
Categorisation
Plugins, plugin versions, and supported versions of Moodle
Reviews and awards
Version controll systems and downloads
Reporting and nofitications
Database structure
The following is the puposed database structure for this new system.
local_contrib_plugin | ||
---|---|---|
id | int (10) unsigned not null | |
categoryid | int (10) unsigned not null | |
name | varchar (255) not null | The name of the plugin |
shortdescription | smalltext | A short plain text description of the module |
description | mediumtext | A complete description of the plugin |
descriptionformat | int(2) unsigned default 0 not null | |
faqs | mediumtext | Frequently asked questions for/about this plugin |
faqsformat | int(2) unsigned default 0 not null | |
faqsshow | int(1) unsigned default 0 not null | |
documentation | mediumtext | Documenation for/about this plugin |
documentationformat | int(2) unsigned default 0 not null | |
documentationshow | int(1) unsigned default 0 not null | |
timecreated | int (10) unsigned | Time the plugin was created within out system |
timelastmodified | int (10) unsigned | Last time the plugin or any of its versions were modified |
approved | int(1) unsigned default 0 not null | Flag to track when this module was approved |
available | int(1) unsigned default 0 not null | Toggle availablility of this module easily. |
local_contrib_version | ||
---|---|---|
Tracks a version of a plugin | ||
id | int (10) unsigned not null | |
pluginid | int (10) unsigned not null | |
previousversionid | int (10) unsigned not null | |
nextversionid | int (10) unsigned not null | |
version | varchar(255) | |
name | varchar(255) | |
releasenotes | mediumtext | |
releasenotesformat | int(2) unsigned default 0 not null | |
timecreated | int (10) unsigned | |
timelastmodified | int (10) unsigned | |
approved | int(1) unsigned default 0 not null | |
available | int(1) unsigned default 0 not null |
local_contrib_category | ||
---|---|---|
Plugin categories | ||
id | int (10) unsigned not null | |
parentid | int (10) unsigned not null | |
name | varchar (255) not null | The name of this category |
shortdescription | smalltext | A short plain text description of this category |
description | mediumtext | A full description of this category. |
descriptionformat | int(2) unsigned default 0 not null |
local_contrib_contributor | ||
---|---|---|
Tracks the contributors to a project so that no one gets forgotten. | ||
id | int (10) unsigned not null | |
userid | int (10) unsigned not null | |
pluginid | int (10) unsigned not null | |
creator | int(1) unsigned default 0 | |
primary | int(1) unsigned default 0 | |
active | int(1) unsigned default 1 | |
timecreated | int (10) unsigned not null |
local_contrib_software_versions | ||
---|---|---|
Contains the different Moodle versions that a plugin version can support | ||
id | int (10) unsigned not null | |
name | varchar(255) | |
version | decimal (12,5) not null | |
timecreated | int (10) unsigned not null |
local_contrib_supported_versions | ||
---|---|---|
Maps a support Moodle version to a plugin | ||
id | int (10) unsigned not null | |
versionid | int (10) unsigned not null | |
softwareversionid | int (10) unsigned not null |
local_contrib_review | ||
---|---|---|
Used to record plugin version reviews | ||
id | int (10) unsigned not null | |
userid | int (10) unsigned not null | |
versionid | int (10) unsigned not null | |
generalreview | mediumtext | |
generalreviewformat | int(2) unsigned default 0 not null |
local_contrib_review_criteria | ||
---|---|---|
Contains the criteria a plugins versions should be reviewed on. | ||
id | int (10) unsigned not null | |
name | varchar (255) | |
description | mediumtext | |
descriptionformat | int(2) unsigned default 0 not null | |
scaleid | int (10) unsigned not null |
local_contrib_review_outcome | ||
---|---|---|
Contains the outcome and comments of a reviewed criteria | ||
id | int (10) unsigned not null | |
name | varchar (255) | |
description | mediumtext | |
descriptionformat | int(2) unsigned default 0 not null | |
scaleid | int (10) unsigned not null |
local_contrib_awards | ||
---|---|---|
Contains the different awards that can be granted to a plugin and/or plugin version | ||
id | int (10) unsigned not null | |
name | varchar (255) | |
description | mediumtext | |
descriptionformat | int(2) unsigned default 0 not null |
local_contrib_plugin_awards | ||
---|---|---|
Tracks the awards a plugin, or plugin version have been awarded | ||
id | int (10) unsigned not null | |
pluginid | int (10) unsigned not null | |
versionid | int (10) unsigned default NULL | |
timeawarded | int (10) unsigned not null | |
userid | int (10) unsigned not null |
File areas
There are several file areas that will be used within this new system.
Type | Contextid | Component | Filearea | Itemid | |
---|---|---|---|---|---|
Plugin badge | Image [200x200] | CONTEXT_SYSTEM | local_contrib | plugin_badge | Plugin id |
Plugin icon | Image [16x16] | CONTEXT_SYSTEM | local_contrib | plugin_icon | Plugin id |
Plugin screenshots | Images 0..n | CONTEXT_SYSTEM | local_contrib | plugin_screenshots | Plugin version id |
Review images | Images 0..n | CONTEXT_SYSTEM | local_contrib | review_images | Review id |
Award image | Image [200x200] | CONTEXT_SYSTEM | local_contrib | award_image | Award id |
Award icon | Image [16x16] | CONTEXT_SYSTEM | local_contrib | award_icon | Award id |
Capabilities
The following are the capabilities that this new local plugin will introduce and utilise.
Capability | Description |
---|---|
local/contrib:view | View the system |
local/contrib:viewunapproved | View unapproved plugins |
local/contrib:createplugins | Create new plugins within the system |
local/contrib:editownplugins | Edit plugins the user previously created |
local/contrib:editanyplugin | Edit any plugins within the system |
local/contrib:deleteownplugin | Delete a plugin you created |
local/contrib:deleteanyplugin | Delete a plugin |
local/contrib:deleteownpluginversion | Delete a plugin version you created |
local/contrib:deleteanypluginversion | Delete a plugin version |
local/contrib:approveplugin | Approve a plugin |
local/contrib:approvepluginversion | Approve a plugin version |
local/contrib:publishreviews | Create and publish a review |
local/contrib:editownreview | Edit a review you created |
local/contrib:editanyreview | Edit a review written by anyone |
local/contrib:comment | Add a comment on a plugin, plugin version, or review |
local/contrib:rate | Rate a plugin or plugin version |
local/contrib:managesupportableversions | Manage supportable |
Screen mockups
The following are the navigation screens for the system, these are screens that will be readily accessible to those who are not logged in or have little or no permissions other than view.
The front page
A category view
Viewing a plugin
Viewing a version of a plugin
Reading a review
Downloading a version of a plugin
Plugin administration screens
Creating a plugin
Creating a plugin version
Adding plugin information
System administration screens
General settings
Managing categories
Managing Moodle versions
Managing awards
Managing supportable versions
Reports
Plugin report
Plugin approval report
Plugin version approval report
Recent activity
Requiring attention
Review report
Required core changes
One of the goals for this new system was to get it using the core Moodle systems where possible and practical. Presently this proposal relies of several changes been made to core systems in order to get them into a usable state by this plugin. While I understand it is not desirable to have to make core changes I do think that in all cases making these changes would be of general benefit anyway. In all cases I am happy to be responsible to for making the required changes.
Changes to the ratings API
Presently the ratings system is VERY limited. When a rating is stored is associated by a context and an item id. The problem with this of course is that it immediatly limits ratings to be applied to only one structure per context. In the case of this new system which is currently planned as a local plugin it is running under the system context which immediatly makes the rating system unusable. As part of the development of this new system I would like to purpose the following changes at the same time:
- Add two new columns to the rating table in the database that are similar to fields found in the file table
- component (string 255) This is the frankenstyle name of the component the rating relates to e.g. mod_forum, local_contrib
- ratingarea (string 255) This is a unique name that the utilisine component can use to allow several areas within a component to be rated e.g. for the forum you may have post, and discussion.
- Extend the API to require the two new fields but provide backwards compatability to working without them.
- Review all locations using the rating system presently and refactor to make use of these two new fields.
Add support for local plugins to use file API
Presently local plugins are unable to make use of the file API because there is no provisioning for them within pluginfile.php.
I would like to see support added for files within local plugins in a similar way as to modules and blocks.
I think that the following snippet of code would just about do the job:
diff --git a/pluginfile.php b/pluginfile.php
index 0ab8428..4e756b2 100644
--- a/pluginfile.php
+++ b/pluginfile.php
@@ -730,6 +730,25 @@ if ($component === 'blog') {
}
send_file_not_found();
+} else if (strpos($component, 'local_') === 0) {
+ $localpluginname = substr($component, 6);
+
+ if ($context->contextlevel != CONTEXT_SYSTEM) {
+ // local plugins can only exist within the system context
+ send_file_not_found();
+ }
+
+ $libfile = "$CFG->dirroot/local/$localpluginname/lib.php";
+ if (!file_exists($libfile)) {
+ send_file_not_found();
+ }
+ require_once($libfile);
+
+ $function = $compontent.'_pluginfile';
+ if (function_exists($function)) {
+ $function($filearea, $args, $forcedownload);
+ }
+ send_file_not_found();
} else if (strpos($component, '_') === false) {
// all core subsystems have to be specified above, no more guessing here!
This would require local plugins to define a method such as local_contrib_pluginfile in order to handle files.
More information
- MDLSITE-406 Modules and Plugins Database - an improved rating system
- http://moodle.org/mod/forum/discuss.php?d=92972 Modules and Plugins Database - an improved rating system
- MDLSITE-571 Research a replacement for the modules and plugins database