Moodle 安装插件:修订间差异

来自MoodleDocs
跳转至:导航、​搜索
第12行: 第12行:
 这里的插件可以是标准的插件(包含在 Moodle 下载包中)或者是其他的一些扩展。
 这里的插件可以是标准的插件(包含在 Moodle 下载包中)或者是其他的一些扩展。


== Considerations for production sites (skip if you're just moodling) ==
== 考虑运行在生产环境下的 Moodle (如果你是初学者,请跳过这部分内容) ==


'''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. This is however improving over time with the evolving new plugins directory system.
''' 非常重要''' 警告:请非常小心,一些插件没有被 Moodle 官方进行检查,这些插件可能在质量和稳定性上对你 Moodle 安装实例的影响也没有进行评估。如果你安装的 Moodle 插件与你期望的有差距的时候,这个插件带来的安全隐患可能远远超过这个插件不能工作这么简单。这些是随着 Moodle 插件目录的发展而进行改善的。


* If you have a large site for production purposes consider if 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.
当你希望安装一个新的 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?
* 如果你的生产环境中运行了一个非常大的 Moodle 网站,你在安装任何插件的时候需要认真考虑是否''' 真正''' 需要这个扩展。 更多的扩展意味着更多的事情需要支持,更多的潜在威胁,在升级的时候需要担心更多。
* Beware of ''patches'' ([https://moodle.org/plugins/browse.php?list=category&id=38 Moodle Plugins Directory Other category]) ! 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.
* 这个扩这是否提供支持和维护?如果出现了问题,你是否能获得有效的技术支持,如果你提交了bug,这些bug能否被修复。
* 如果这个扩展不能被 Moodle 的新版本支持,你将打算怎么做?
* 担心 '' 补丁'' ([https://moodle.org/plugins/browse.php?list=category&id=38 Moodle Plugins Directory Other category]) !如果你安装的 Moodle 扩展修改和替换了 Moodle 的核心文件,那么就需要十分小心了。这个可能仅仅能保证在 Moodle 的 build 版本中运行,在实际生产环境中,可能会被 Moodle 的升级程序重写而导致系统错误。


==Installing an add-on==
==Installing an add-on==

2013年8月24日 (六) 15:08的版本

通过向 Moodle 中安装一些可选的扩展,可以扩展 Moodle 的功能。

比如可以通过向 Moodle 安装插件增加新的活动,新的考试问题类型,新的报表以及可以与其他系统进行整合等更多的功能。

'插件' 和 '扩展' 在 Moodle 中是什么意思

'plugin' 和 'add-on',我们通常认为 plugin 对照于中文的插件,add-on 对照于中文的扩展。

Moodle = 核心代码 + 插件

这里的插件可以是标准的插件(包含在 Moodle 下载包中)或者是其他的一些扩展。

考虑运行在生产环境下的 Moodle (如果你是初学者,请跳过这部分内容)

非常重要 警告:请非常小心,一些插件没有被 Moodle 官方进行检查,这些插件可能在质量和稳定性上对你 Moodle 安装实例的影响也没有进行评估。如果你安装的 Moodle 插件与你期望的有差距的时候,这个插件带来的安全隐患可能远远超过这个插件不能工作这么简单。这些是随着 Moodle 插件目录的发展而进行改善的。

当你希望安装一个新的 Moodle 扩展的时候,你需要考虑认真考虑下面的内容:

  • 如果你的生产环境中运行了一个非常大的 Moodle 网站,你在安装任何插件的时候需要认真考虑是否真正需要这个扩展。 更多的扩展意味着更多的事情需要支持,更多的潜在威胁,在升级的时候需要担心更多。
  • 这个扩这是否提供支持和维护?如果出现了问题,你是否能获得有效的技术支持,如果你提交了bug,这些bug能否被修复。
  • 如果这个扩展不能被 Moodle 的新版本支持,你将打算怎么做?
  • 担心 补丁 (Moodle Plugins Directory Other category)!如果你安装的 Moodle 扩展修改和替换了 Moodle 的核心文件,那么就需要十分小心了。这个可能仅仅能保证在 Moodle 的 build 版本中运行,在实际生产环境中,可能会被 Moodle 的升级程序重写而导致系统错误。

Installing an add-on

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.

Template:New featuresIn 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

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

Installing via uploaded ZIP file

  1. Go to the Moodle plugins directory, select Moodle 2.5 as version, then choose an add-on 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 add-ons.
  3. Upload the ZIP file, select the appropriate plugin type, tick the acknowledgement checkbox, then click the button 'Install add-on from the ZIP file'.
  4. Check that you obtain a 'Validation passed!' message, then click the button 'Install add-on'.
File:install add-ons.png
Install add-ons
File:add-on package validation.png
Add-on 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

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).

First, establish the correct place in the Moodle code tree for the add-on 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 Moodle plugins directory, select Moodle 2.5 as version, then choose an add-on 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 add-on 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 add-on 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.

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.

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 add-on 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 the appropriate forum in 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).

Uninstalling an add-on

To uninstall an add-on

  1. Go to Administration> Site Administration > Plugins > Plugins overview and click the Uninstall link opposite the add-on 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

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

Plugins overview

File:plugins overview.png
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).

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 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

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.

Preventing installing add-ons 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 On-click add-on installation
// feature and hide it from the server administration UI.
//
//      $CFG->disableonclickaddoninstall = true;

See also

For developers: