Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

version.php: Difference between revisions

From MoodleDocs
No edit summary
No edit summary
Line 1: Line 1:
This file is included in the main directory of every type of plugin.
This file is included in the main directory of plugin. It is compulsory for the most of plugin types. Even when not compulsory it is highly recommended.  


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.
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.
Line 5: Line 5:
The file is a standard PHP file, starting with an opening '<?php' tag and defining the following variables:
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;
* $plugin->version = 2011051000;
Line 20: Line 21:
** Optional - Human-readable version name
** Optional - Human-readable version name
* $plugin->dependencies = array ('mod_forum' => ANY_VERSION, 'mod_data'  => 2010020300);   
* $plugin->dependencies = array ('mod_forum' => ANY_VERSION, 'mod_data'  => 2010020300);   
** Optional - list of other plugins that are required for this plugin to work
** 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
** In this example, the plugin requires any version of the forum activity and version '20100020300' (or above) of the database activity
[[Category:Plugins]]

Revision as of 00:50, 6 December 2011

This file is included in the main directory of plugin. It is compulsory for the most of plugin types. Even when not compulsory it is highly recommended.

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)
  • $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
  • $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