This file is included in the main directory of plugin. It is compulsory for most plugin types. Even when not compulsory it is highly recommended. It is required in the Plugins Directory for Moodle 2 and onwards.
It contains a number of fields, which are used during the install / upgrade process to make sure the plugin is compatible with the current Moodle install, as well as spotting whether an upgrade is needed.
The file is a standard PHP file, starting with an opening '<?php' tag and defining the following variables:
Note! For Activity modules replace $plugin-> with $module-> in the following example!
- $plugin->version = 2011051000;
- Required - the version number of your plugin in the form YYYYMMDDxx, so this example is 10th May 2011 (with 00 indicating this is the first version for that day)
- $plugin->requires = 2010112400;
- Optional - minimum version number of Moodle that this plugin requires (Moodle 1.9 = 2007101509; Moodle 2.0 = 2010112400; Moodle 2.1 = 2011070100; Moodle 2.2 = 2011120500; Moodle 2.3 = 2012062500). See Releases for a full list.
- $plugin->cron = 0;
- Optional - time interval (in seconds) between calls to the plugin's 'cron' function; set to 0 to disable the cron function calls.
- Cron support is not yet implemented for all plugins.
- $plugin->component = 'plugintype_pluginname';
- Optional - frankenstyle plugin name, strongly recommended. It is used for installation and upgrade diagnostics.
- $plugin->maturity = MATURITY_STABLE;
- Optional - how stable the plugin is: MATURITY_ALPHA, MATURITY_BETA, MATURITY_RC, MATURITY_STABLE (Moodle 2.0 and above)
- $plugin->release = '2.x (Build: 2011051000)';
- Optional - Human-readable version name
- $plugin->dependencies = array('mod_forum' => ANY_VERSION, 'mod_data' => 2010020300);
- Optional - list of other plugins that are required for this plugin to work (Moodle 2.2 and above)
- In this example, the plugin requires any version of the forum activity and version '20100020300' (or above) of the database activity
Here is a template to copy and paste:
// This file is part of Moodle - http://moodle.org/
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
* @package TODO_FRANKENSTYLE
* @copyright TODO
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
defined('MOODLE_INTERNAL') || die();
$plugin->version = TODO;
$plugin->requires = TODO; // See http://docs.moodle.org/dev/Moodle_Versions
$plugin->cron = 0;
$plugin->component = 'TODO_FRANKENSTYLE';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = 'TODO';
$plugin->dependencies = array(
'mod_forum' => ANY_VERSION,
'mod_data' => TODO