Note: You are currently viewing documentation for Moodle 3.0. Up-to-date documentation for the latest stable version of Moodle may be available here: Installing plugins.

Installing plugins: Difference between revisions

From MoodleDocs
(link to Add on review criteria)
(note about certain hosting solutions preventing plugins installation)
(31 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{Installing Moodle}}
{{Installing Moodle}}
An add-on is an optional plugin for adding additional features and functionality to Moodle, such as new activities, new quiz question types, new reports, integrations with other systems and many more.
==Why install additional plugins?==


==What is meant by the words 'plugin' and 'add-on'?==
Plugins enable you to add additional features and functionality to Moodle, such as new activities, new quiz question types, new reports, integrations with other systems and many more.


Moodle = core code + plugins
{{Note|Certain hosting solutions, such as [https://moodle.com/cloud/ MoodleCloud], prevent plugins being installed from within Moodle.}}
== Considerations for production sites (skip if you're just moodling) ==


Plugins may be either standard plugins (included in the Moodle download package) or add-ons.
'''VERY IMPORTANT''' Warning: Please be aware that some plugins have not been reviewed, and the quality and/or suitability for your Moodle site has not been checked. Please be careful. It may not do what you expect, it may have serious security issues or it may even not work at all. This is however improving over time with the evolving new plugins directory system.


== Before you do anything else... ==
* If you have a large site for production purposes consider if you '''really''' need the plugin? More functionality means more things to support, more things to (potentially) go wrong and more things to worry about at upgrade time.
* Is the plugin supported and maintained? If something goes wrong can you get support? Will bugs be fixed?
* If the plugin does not work in a future version of Moodle, what will you do about it?
* Beware of ''patches'' ([https://moodle.org/plugins/browse.php?list=category&id=38 Moodle Plugins Directory Other category]) ! If a plugin modifies or replaces core files then be very careful. It can only be guaranteed to work with the exact build (version) of Moodle it was created for and is highly unlikely to survive a Moodle upgrade.


'''VERY IMPORTANT''' Warning: Please be aware that some add-ons have not been reviewed, and the quality and/or suitability for your Moodle site has not been checked. Please be careful. It may not do what you expect, it may have serious security issues or it may even not work at all.
==Installing a plugin==


* Do you '''really''' need the add-on? More functionality means more things to support, more things to (potentially) go wrong and more things to worry about at upgrade time.
To install a plugin, its source code must be put (deployed) into the appropriate location inside the Moodle installation directory and the main administration page ''Administration > Site administration > Notifications'' must be visited. There are three ways how the plugin code can be deployed into Moodle.
* Is the add-on supported and maintained? If something goes wrong can you get support? Will bugs be fixed?
* If the add-on does not work in a future version of Moodle, what will you do about it?
* Beware of ''patches''! If an add-on modifies or replaces core files then be very careful. It can only be guaranteed to work with the exact build (version) of Moodle it was created for and is highly unlikely to survive a Moodle upgrade.


==Installing an add-on==
Plugin code may be deployed from within Moodle, either directly from the Moodle plugins directory or by uploading a ZIP file. The web server process has to have write access to the plugin type folder where the new plugin is to be installed in order to use either of these methods.


To install an add-on, its source code must be put (deployed) into the appropriate location inside the Moodle installation directory and the main administration page ''Administration > Site administration > Notifications'' must be visited. There are three ways how the add-on code can be deployed into Moodle.
Alternatively, a plugin may be deployed manually at the server.
 
{{New features}}In Moodle 2.5 onwards, an add-on code may be deployed from within Moodle, either directly from the Moodle plugins directory or by uploading a ZIP file. The web server process has to have write access to the plugin type folder where the new add-on is to be installed in order to use either of these methods.
 
Alternatively, an add-on code may be deployed manually at the server.


===Installing directly from the Moodle plugins directory===
===Installing directly from the Moodle plugins directory===


# Login as an admin and go to ''Administration > Site administration > Plugins > Install add-ons''.
# Login as an admin and go to ''Administration > Site administration > Plugins > Install plugins''.
# Click the button 'Install add-ons from Moodle plugins directory'.
# Click the button 'Install plugins from Moodle plugins directory'.
# Search for a plugin with an Install button (i.e. suitable for 2.5), click the Install button then click Continue.
# Search for a plugin with an Install button, click the Install button then click Continue.
# Check that you obtain a 'Validation passed!' message, then click the button 'Install add-on'.
# Confirm the installation request
# Check the plugin validation report


===Installing via uploaded ZIP file===
===Installing via uploaded ZIP file===


# Go to the [https://moodle.org/plugins Moodle plugins directory], select Moodle 2.5 as version, then choose an add-on with a Download button and download the ZIP file.
# Go to the [https://moodle.org/plugins Moodle plugins directory], select your current Moodle version, then choose a plugin with a Download button and download the ZIP file.
# Login to your Moodle site as an admin and go to ''Administration > Site administration > Plugins > Install add-ons''.
# Login to your Moodle site as an admin and go to ''Administration > Site administration > Plugins > Install plugins''.
# Upload the ZIP file, select the appropriate plugin type, tick the acknowledgement checkbox, then click the button 'Install add-on from the ZIP file'.
# Upload the ZIP file. You should only be prompted to add extra details (in the Show more section) if your plugin is not automatically detected.
# Check that you obtain a 'Validation passed!' message, then click the button 'Install add-on'.
# If your target directory is not writeable, you will see a warning message.
# Check the plugin validation report


{|
{|
| [[File:install add-ons.png|thumb|Install add-ons]]
| [[File:plugin1.png|thumb|Install plugins]]
| [[File:add-on package validation.png|thumb|Add-on package validation]]
| [[File:add-on package validation.png|thumb|Plugin package validation]]
|}
|}
For both of the above methods, after clicking the button 'Install add-on', you will then be automatically redirected to ''Settings > Site administration > Notifications'' and the installation process (i.e. creating required database tables etc) will happen.


===Installing manually at the server===
===Installing manually at the server===


If you can't deploy the add-on code via the administration web interface, you have to copy it to the server file system manually (e.g. if the web server process does not have write access to the Moodle installation tree to do this for you).
If you can't deploy the plugin code via the administration web interface, you have to copy it to the server file system manually (e.g. if the web server process does not have write access to the Moodle installation tree to do this for you).


First, establish the correct place in the Moodle code tree for the add-on type. Common locations are:
First, establish the correct place in the Moodle code tree for the plugin type. Common locations are:


* /path/to/moodle/theme/ - themes
* /path/to/moodle/theme/ - themes
Line 61: Line 58:
See [[:dev:Plugins]] for the full list of all plugin types and their locations within the Moodle tree.
See [[:dev:Plugins]] for the full list of all plugin types and their locations within the Moodle tree.


# Go to the [https://moodle.org/plugins Moodle plugins directory], select Moodle 2.5 as version, then choose an add-on with a Download button and download the ZIP file.
# Go to the [https://moodle.org/plugins Moodle plugins directory; select your current Moodle version, then choose a plugin with a Download button and download the ZIP file.
# Upload or copy it to your Moodle server.
# Upload or copy it to your Moodle server.
# Unzip it in the right place for the plugin type (or follow add-on instructions).  
# Unzip it in the right place for the plugin type (or follow the plugin instructions).  
# In your Moodle site (as admin) go to ''Settings > Site administration > Notifications'' (you should, for most plugin types, get a message saying the add-on is installed).
# In your Moodle site (as admin) go to ''Settings > Site administration > Notifications'' (you should, for most plugin types, get a message saying the plugin is installed).


Note: The add-on may contain language files.  They'll be found by your Moodle automatically. These language strings can be customized using the standard ''Settings > Site administration > Language'' editing interface. If you get a "Database error" when you try to edit your language files, there is a strong chance that the language files included within the downloaded ZIP file of this add-on have a coding problem. If you delete the ''plugin_name/lang/other_language_different_to_English/'' folder with the new language strings and the database error disappears, this is indeed the case. Please notify the plugin maintainer, so that it can be fixed in future releases.
Note: The plugin may contain language files.  They'll be found by your Moodle automatically. These language strings can be customized using the standard ''Settings > Site administration > Language'' editing interface. If you get a "Database error" when you try to edit your language files, there is a strong chance that the language files included within the downloaded ZIP file of this plugin have a coding problem. If you delete the ''plugin_name/lang/other_language_different_to_English/'' folder with the new language strings and the database error disappears, this is indeed the case. Please notify the plugin maintainer, so that it can be fixed in future releases.


==Troubleshooting==
==Troubleshooting==
Line 75: Line 72:


;tool_installaddon/err_curl_exec - cURL error 60 : This suggests problems with the validation of the SSL certificate of the remote (moodle.org) site. This is also a known problem in Moodle Windows 7 servers running the Moodle package for Windows. See [[SSL certificate for moodle.org]] for more info and possible solutions.
;tool_installaddon/err_curl_exec - cURL error 60 : This suggests problems with the validation of the SSL certificate of the remote (moodle.org) site. This is also a known problem in Moodle Windows 7 servers running the Moodle package for Windows. See [[SSL certificate for moodle.org]] for more info and possible solutions.
===A file permissions error has occurred===
On certain 3.0.x versions, when installing plugins via the administration interface, the Moodle uses the configuration settings <tt>$CFG->directorypermissions</tt> and <tt>$CFG->filepermissions</tt>. If these are not defined explicitly in your config.php, the default value is set automatically to 777 (rwxrwxrwx) for directories and 666 (rw-rw-rw-) for files (see lib/setup.php).
If this default behaviour does not fit your needs and hosting environment, you may wish to specify more strict setting such as
$CFG->directorypermissions = 02750;
A common error after installing plugins is that when you create an instance of the module and then save and display it, it reports the error, "A file permissions error has occurred. Please check the permissions on the script and the directory it is in and try again." If you get this, the file permissions of the package are mostl likely set to 711 preventing them from running correctly. With your preferred FTP client or via your web hosts control panel, set the file permissions of all the files and directories in the installed module, e.g. /moodle/mod/[myplugin]/ to 755 and then see if you can successfully view the module instance.
===Default exception handler: Error writing to database Debug: Duplicate entry 'en_us-...===
* These errors are usually caused by a third party plugin.
* To find the involved plugin, go to [http://lang.moodle.org http://lang.moodle.org] and use the AMOS tool to find all the strings with the given string identifier.
* Remove the suspected plugin and check if the error has disappeared. If so, please contact the plugin maintainer and report this issue.
* Please see [https://moodle.org/mod/forum/discuss.php?d=219504 this forum thread] for known causes and fixes.


===When installing manually===
===When installing manually===


* Check the file permissions. The web server needs to be able to read the plugin files. If the the rest of Moodle works then try to make the plugin permissions and ownership match.  
* Check the file permissions. The web server needs to be able to read the plugin files. If the the rest of Moodle works then try to make the plugin permissions and ownership match.  
* Did you '''definitely''' unzip or install the add-on in the correct place?
* Did you '''definitely''' unzip or install the plugin in the correct place?
* Because Moodle scans plugin folders for new plugins you cannot have any other files or folders there. Make sure you deleted the zip file and don't try to rename (for example) an old version of the plugin to some other name - it will break.
* Because Moodle scans plugin folders for new plugins you cannot have any other files or folders there. Make sure you deleted the zip file and don't try to rename (for example) an old version of the plugin to some other name - it will break.
* Make sure the directory name for the plugin is correct. All the names '''have''' to match. If you change the name then it won't work.
* Make sure the directory name for the plugin is correct. All the names '''have''' to match. If you change the name, then it won't work.


===Obtaining help===
===Obtaining help===


Ask in the appropriate forum in [http://moodle.org/course/view.php?id=5 Using Moodle]. Make sure you describe your system (including versions of MySQL, PHP etc.), what you tried and what happened. Copy and paste error messages exactly. Provide the link to the version of the add-on you downloaded (some have very similar names).
Ask in a forum in [http://moodle.org/course/view.php?id=5 Moodle in English]. Make sure you describe your system (including versions of MySQL, PHP etc.), what you tried and what happened. Copy and paste error messages exactly. Provide the link to the version of the plugin you downloaded (some have very similar names).


==Uninstalling an add-on==
==Uninstalling a plugin==


To uninstall an add-on
To uninstall a plugin
# Go to ''Administration> Site Administration > Plugins > Plugins overview'' and click the Uninstall link opposite the add-on you wish to remove
# Go to ''Administration> Site Administration > Plugins > Plugins overview'' and click the Uninstall link opposite the plugin you wish to remove
# Use a file manager to remove/delete the actual plugin directory as instructed, otherwise Moodle will reinstall it next time you access the site administration
# Use a file manager to remove/delete the actual plugin directory as instructed, otherwise Moodle will reinstall it next time you access the site administration


Note: Certain plugin types offer the removal from the disk as well, though not yet all.
==Plugins overview==


==Plugins overview==
[[File:plugins overview.png|thumb|center|400px|Plugins overview highlighting available check button]]


[[File:plugins overview.png|thumb|left|Plugins overview highlighting available update with install button]]The Plugins overview page in ''Administration > Site Administration > Plugins > Plugins overview'' lists all installed plugins, together with the version number, availability (enabled or disabled) and settings link (if applicable).
The Plugins overview page in ''Administration > Site Administration > Plugins > Plugins overview'' lists all installed plugins, together with the version number,release, availability (enabled or disabled) and settings link (if applicable).


A 'Check for available updates' button enables admins to quickly check for any updates available to standard plugins or add-ons installed on the site (from the [http://moodle.org/plugins plugins directory]). Any updates available are highlighted, with further information and a download link in the notes column opposite the plugin.
A 'Check for available updates' button enables admins to quickly check for any updates available for plugins installed on the site (from the [http://moodle.org/plugins plugins directory]). Any updates available are highlighted, with further information and a download link in the notes column opposite the plugin.


===Plugin updating from within Moodle===
===Plugin updating from within Moodle===


In Moodle 2.4 onwards, an administrator can enable updates deployment in  ''Administration > Site Administration > Server > Update notifications''. Then when updates are available, 'Install this update' buttons are shown on the Plugins overview page. See [[Automatic updates deployment]] for more details.
An administrator can enable updates deployment in  ''Administration > Site Administration > Server > Update notifications''. Then when updates are available, 'Install this update' buttons are shown on the Plugins overview page. See [[Automatic updates deployment]] for more details.


==Preventing installing add-ons from within Moodle==
==Preventing installing plugins from within Moodle==


If required, installing and updating from within Moodle can be prevented by copying the following lines of code from config-dist.php and pasting them in config.php.
If required, installing and updating from within Moodle can be prevented by copying the following lines of code from config-dist.php and pasting them in config.php.


// Use the following flag to completely disable the On-click add-on installation
<code php>
// feature and hide it from the server administration UI.
// Use the following flag to completely disable the installation of plugins
//
// (new plugins, available updates and missing dependencies) and related
//     $CFG->disableonclickaddoninstall = true;
// features (such as cancelling the plugin installation or upgrade) via the
// server administration web interface.
$CFG->disableupdateautodeploy = true;
</code>


==See also==
==See also==
 
* [https://moodle.org/mod/forum/discuss.php?d=325804 list of (year 2015) favorite plugins] by Gavin Henrick
* [[Notifications]] for further details of update notifications
* [[Notifications]] for further details of update notifications
* [[Add-on Review Criteria]]
* [[Plugin Review Criteria]]
* [[Add-on FAQ]]
* [[Plugins FAQ]]
* Using Moodle [http://moodle.org/mod/forum/view.php?id=44 General add-ons forum]
* Moodle in English [http://moodle.org/mod/forum/view.php?id=44 General plugins forum]
* [[Installing Moodle from Git repository#Installing a contributed extension from its Git repository|Installing a contributed extension from its Git repository]]
* [[Installing Moodle from Git repository#Installing a contributed extension from its Git repository|Installing a contributed extension from its Git repository]]
* [http://www.somerandomthoughts.com/blog/2013/05/07/managing-add-ons-in-moodle-2-5/ Managing add-ons in Moodle 2.5] blog post by Gavin Henrick
* [http://www.somerandomthoughts.com/blog/2013/05/07/managing-add-ons-in-moodle-2-5/ Managing add-ons in Moodle 2.5] blog post by Gavin Henrick
*[http://youtu.be/RxlmVzIllVk Moodle 2 Plugins Administration]  MoodleBites video on YouTube 
* [http://youtu.be/K3MYE8am7M4 Install a New Theme]  MoodleBites video on YouTube


For developers:
For developers:
Line 132: Line 150:


[[de:Plugins installieren]]
[[de:Plugins installieren]]
[[es:Instalando plugins]]
[[es:Instalar complementos]]

Revision as of 07:46, 17 June 2016

Why install additional plugins?

Plugins enable you to add additional features and functionality to Moodle, such as new activities, new quiz question types, new reports, integrations with other systems and many more.

Note: Certain hosting solutions, such as MoodleCloud, prevent plugins being installed from within Moodle.


Considerations for production sites (skip if you're just moodling)

VERY IMPORTANT Warning: Please be aware that some plugins have not been reviewed, and the quality and/or suitability for your Moodle site has not been checked. Please be careful. It may not do what you expect, it may have serious security issues or it may even not work at all. This is however improving over time with the evolving new plugins directory system.

  • If you have a large site for production purposes consider if you really need the plugin? More functionality means more things to support, more things to (potentially) go wrong and more things to worry about at upgrade time.
  • Is the plugin supported and maintained? If something goes wrong can you get support? Will bugs be fixed?
  • If the plugin does not work in a future version of Moodle, what will you do about it?
  • Beware of patches (Moodle Plugins Directory Other category) ! If a plugin modifies or replaces core files then be very careful. It can only be guaranteed to work with the exact build (version) of Moodle it was created for and is highly unlikely to survive a Moodle upgrade.

Installing a plugin

To install a plugin, its source code must be put (deployed) into the appropriate location inside the Moodle installation directory and the main administration page Administration > Site administration > Notifications must be visited. There are three ways how the plugin code can be deployed into Moodle.

Plugin code may be deployed from within Moodle, either directly from the Moodle plugins directory or by uploading a ZIP file. The web server process has to have write access to the plugin type folder where the new plugin is to be installed in order to use either of these methods.

Alternatively, a plugin may be deployed manually at the server.

Installing directly from the Moodle plugins directory

  1. Login as an admin and go to Administration > Site administration > Plugins > Install plugins.
  2. Click the button 'Install plugins from Moodle plugins directory'.
  3. Search for a plugin with an Install button, click the Install button then click Continue.
  4. Confirm the installation request
  5. Check the plugin validation report

Installing via uploaded ZIP file

  1. Go to the Moodle plugins directory, select your current Moodle version, then choose a plugin with a Download button and download the ZIP file.
  2. Login to your Moodle site as an admin and go to Administration > Site administration > Plugins > Install plugins.
  3. Upload the ZIP file. You should only be prompted to add extra details (in the Show more section) if your plugin is not automatically detected.
  4. If your target directory is not writeable, you will see a warning message.
  5. Check the plugin validation report
Install plugins
Plugin package validation

Installing manually at the server

If you can't deploy the plugin code via the administration web interface, you have to copy it to the server file system manually (e.g. if the web server process does not have write access to the Moodle installation tree to do this for you).

First, establish the correct place in the Moodle code tree for the plugin type. Common locations are:

  • /path/to/moodle/theme/ - themes
  • /path/to/moodle/mod/ - activity modules and resources
  • /path/to/moodle/blocks/ - sidebar blocks
  • /path/to/moodle/question/type/ - question types
  • /path/to/moodle/course/format/ - course formats
  • /path/to/moodle/admin/report/ - admin reports

See dev:Plugins for the full list of all plugin types and their locations within the Moodle tree.

  1. Go to the [https://moodle.org/plugins Moodle plugins directory; select your current Moodle version, then choose a plugin with a Download button and download the ZIP file.
  2. Upload or copy it to your Moodle server.
  3. Unzip it in the right place for the plugin type (or follow the plugin instructions).
  4. In your Moodle site (as admin) go to Settings > Site administration > Notifications (you should, for most plugin types, get a message saying the plugin is installed).

Note: The plugin may contain language files. They'll be found by your Moodle automatically. These language strings can be customized using the standard Settings > Site administration > Language editing interface. If you get a "Database error" when you try to edit your language files, there is a strong chance that the language files included within the downloaded ZIP file of this plugin have a coding problem. If you delete the plugin_name/lang/other_language_different_to_English/ folder with the new language strings and the database error disappears, this is indeed the case. Please notify the plugin maintainer, so that it can be fixed in future releases.

Troubleshooting

Errors

If you obtain an error, please turn debugging on to obtain additional information about the cause of the error.

tool_installaddon/err_curl_exec - cURL error 60
This suggests problems with the validation of the SSL certificate of the remote (moodle.org) site. This is also a known problem in Moodle Windows 7 servers running the Moodle package for Windows. See SSL certificate for moodle.org for more info and possible solutions.

A file permissions error has occurred

On certain 3.0.x versions, when installing plugins via the administration interface, the Moodle uses the configuration settings $CFG->directorypermissions and $CFG->filepermissions. If these are not defined explicitly in your config.php, the default value is set automatically to 777 (rwxrwxrwx) for directories and 666 (rw-rw-rw-) for files (see lib/setup.php).

If this default behaviour does not fit your needs and hosting environment, you may wish to specify more strict setting such as

$CFG->directorypermissions = 02750;

A common error after installing plugins is that when you create an instance of the module and then save and display it, it reports the error, "A file permissions error has occurred. Please check the permissions on the script and the directory it is in and try again." If you get this, the file permissions of the package are mostl likely set to 711 preventing them from running correctly. With your preferred FTP client or via your web hosts control panel, set the file permissions of all the files and directories in the installed module, e.g. /moodle/mod/[myplugin]/ to 755 and then see if you can successfully view the module instance.

Default exception handler: Error writing to database Debug: Duplicate entry 'en_us-...

  • These errors are usually caused by a third party plugin.
  • To find the involved plugin, go to http://lang.moodle.org and use the AMOS tool to find all the strings with the given string identifier.
  • Remove the suspected plugin and check if the error has disappeared. If so, please contact the plugin maintainer and report this issue.
  • Please see this forum thread for known causes and fixes.

When installing manually

  • Check the file permissions. The web server needs to be able to read the plugin files. If the the rest of Moodle works then try to make the plugin permissions and ownership match.
  • Did you definitely unzip or install the plugin in the correct place?
  • Because Moodle scans plugin folders for new plugins you cannot have any other files or folders there. Make sure you deleted the zip file and don't try to rename (for example) an old version of the plugin to some other name - it will break.
  • Make sure the directory name for the plugin is correct. All the names have to match. If you change the name, then it won't work.

Obtaining help

Ask in a forum in Moodle in English. Make sure you describe your system (including versions of MySQL, PHP etc.), what you tried and what happened. Copy and paste error messages exactly. Provide the link to the version of the plugin you downloaded (some have very similar names).

Uninstalling a plugin

To uninstall a plugin

  1. Go to Administration> Site Administration > Plugins > Plugins overview and click the Uninstall link opposite the plugin you wish to remove
  2. Use a file manager to remove/delete the actual plugin directory as instructed, otherwise Moodle will reinstall it next time you access the site administration

Plugins overview

Plugins overview highlighting available check button

The Plugins overview page in Administration > Site Administration > Plugins > Plugins overview lists all installed plugins, together with the version number,release, availability (enabled or disabled) and settings link (if applicable).

A 'Check for available updates' button enables admins to quickly check for any updates available for plugins installed on the site (from the plugins directory). Any updates available are highlighted, with further information and a download link in the notes column opposite the plugin.

Plugin updating from within Moodle

An administrator can enable updates deployment in Administration > Site Administration > Server > Update notifications. Then when updates are available, 'Install this update' buttons are shown on the Plugins overview page. See Automatic updates deployment for more details.

Preventing installing plugins from within Moodle

If required, installing and updating from within Moodle can be prevented by copying the following lines of code from config-dist.php and pasting them in config.php.

// Use the following flag to completely disable the installation of plugins // (new plugins, available updates and missing dependencies) and related // features (such as cancelling the plugin installation or upgrade) via the // server administration web interface. $CFG->disableupdateautodeploy = true;

See also

For developers: