Moodle 安装插件:修订间差异

来自MoodleDocs
跳转至:导航、​搜索
 
(未显示同一用户的8个中间版本)
第60行: 第60行:
|}
|}


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.
通过上面 2 种方法,当你单击按钮【安装扩展】,你将会被自动导向到 【首页 > 网站管理 > 插件 > 安装扩展】 (对应的英文路径为:Administration > Site administration > Plugins > Install add-ons)下,然后开始安装过程(例如,创建必须的数据库表等操作)。


===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).
如果你不能通过管理员的 Web 界面来安装扩展,你需要将文件手工拷贝到系统上(例如,你不具有服务器上 Moodle 安装目录的)。


First, establish the correct place in the Moodle code tree for the add-on type. Common locations are:
首先,需要确认 Moodle 扩展的类型结构。


* /path/to/moodle/theme/ - themes
* /path/to/moodle/theme/ - 主题
* /path/to/moodle/mod/ - activity modules and resources
* /path/to/moodle/mod/ - 活动模块和资源
* /path/to/moodle/blocks/ - sidebar blocks
* /path/to/moodle/blocks/ - 边栏块
* /path/to/moodle/question/type/ - question types
* /path/to/moodle/question/type/ - 问题类型
* /path/to/moodle/course/format/ - course formats
* /path/to/moodle/course/format/ - 课程格式
* /path/to/moodle/admin/report/ - admin reports
* /path/to/moodle/admin/report/ - 管理员报表


See [[:dev:Plugins]] for the full list of all plugin types and their locations within the Moodle tree.
请查看 [[:dev:Plugins]] 来获得所有扩展类型以及他们在 Moodle 网站中的路径。


# 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.
# 进入 [https://moodle.org/plugins Moodle 插件目录] ,选择 Moodle 2.5 版本,然后选择需要的 Moodle 扩展,然后单击下载按钮下载 ZIP 包。
# Upload or copy it to your Moodle server.
# 上传下载的 ZIP 包到你的 Moodle 服务器上。
# Unzip it in the right place for the plugin type (or follow add-on instructions).
# 解压 ZIP 包到正确的位置,这个根据扩展的类型不同而不同,或者请参考扩展的帮助手册。
# 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).
# 在你的网站以 Moodle 管理员的身份进入''Administration > Site administration > Notifications'' ,你应该看到你安装扩展的类型,同时得到扩展已经安装的消息。


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.
  注意:你安装的扩展可能包含了语言文件,这些语言文件可以被你的 Moodle 安装实例自动找到。这些语言文件可以通过: ''Settings > Site administration > Language'' 编辑界面自定义配置。如果在尝试编辑你的语言文件时候,你得到" 数据库错误" 的提示信息,这是因为下载语言文件中的 ZIP 包需要被强制修改,很有可能是下载的这个扩展有程序错误。如果你上传 ''plugin_name/lang/other_language_different_to_English/'' 文件夹,这个数据库错误就会消失的的话,那应该是这个扩展有一个错误语言包的错误,请通知扩展的开发人员,以便于开发人员能在后续版本中进行修复。


==Troubleshooting==
== 解决问题==


===Errors===
=== 错误===


If you obtain an error, please [[Debugging|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.
;tool_installaddon/err_curl_exec - cURL error 60 : 这个问题是需要校验远程(moodle.org )的 SSL 认证信息。这个问题对于运行 Windows 7 的服务器的机器是已知错误,请查看[[moodle.org 的 SSL 认证]] 来得到更多的信息和可能的解决方案。


===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.
* 检查文件的权限。 Web 服务器需要能读取插件文件,如果其他 Moodle 功能正常并能正常工作,请检查插件文件的权限和所属权是否正确。
* 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.
* 因为 Moodle 在插件目录中查找插件,Moodle 将不会扫描其他文件夹。请确认你删除 ZIP 文件而不是将 ZIP 文件重命名,例如将你老版本的插件重命名其他文件名而不删除的话,将会导致错误。
* 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.
* 请确认插件的目录名是正确的,所有的名字必须相同,如果你修改名字的话,插件将不会正常工作。


===获得帮助===
===获得帮助===
第109行: 第109行:
 关于 Moodle 的中文帮助,请参考 OSSEZ 的相关板块 [http://www.ossez.com/forum-54-1.html http://www.ossez.com/forum-54-1.html],尽可能的提供详细信息,必要的时候请多截图。
 关于 Moodle 的中文帮助,请参考 OSSEZ 的相关板块 [http://www.ossez.com/forum-54-1.html http://www.ossez.com/forum-54-1.html],尽可能的提供详细信息,必要的时候请多截图。


==Uninstalling an add-on==
== 卸载一个扩展==


To uninstall an add-on
卸载插件
# Go to ''Administration> Site Administration > Plugins > Plugins overview'' and click the Uninstall link opposite the add-on you wish to remove
# 到路径 ''Administration> Site Administration > Plugins > Plugins overview'' 然后单击你希望卸载插件的【卸载】链接按钮。
# 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
# 使用文件管理员来删除插件目录下的物理文件,否则 Moodle 在你下次访问管理员界面的时候被重新安装。


Note: Certain plugin types offer the removal from the disk as well, though not yet all.
注意:一些插件类型提供从磁盘中直接删除的功能,但是不是所有的扩展都提供这个功能。


==Plugins overview==
== 插件概要==


[[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).
[[File: 插件概要页面.jpg|thumb|left| 插件概要高亮显示了可用的更新和安装按钮]] 插件摘要界面位于 ''Administration > Site Administration > Plugins > Plugins overview'' 路径下,显示了所有已经安装的插件,同时包括版本号,是否可用(启用或者禁用)和设置的链接,如果有这个链接的话。


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.
按钮 ' 检查可用更新' 对管理员可用,被用于快速检查你的插件是否已经有可用的任何更新或者已经安装的更新。任何可用的更新将会被高亮显示,同时也会显示更多的信息和一个下载链接将会在插件的备注栏位中显示。


===Plugin updating from within Moodle===
=== 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.
Moodle 2.4  开始,习惯管理员可以在''Administration > Site Administration > Server > Update notifications'' 中启用更新和部署。


==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.
查看 [[自动更新部署]] 页面来获得更多信息。
 
==禁止你的 Moodle 安装实例安装任何扩展 ==
 
如果需要,Moodle 扩展的安装和更新可以被完全禁止。
 
拷贝 config-dist.php 文件中的下面行中的内容到 config.php 文件。


  // Use the following flag to completely disable the On-click add-on installation
  // Use the following flag to completely disable the On-click add-on installation
第135行: 第141行:
  //
  //
  //    $CFG->disableonclickaddoninstall = true;
  //    $CFG->disableonclickaddoninstall = true;
注意,在实际使用的时候需要取消掉行前的注释。


==See also==
==See also==

2013年8月25日 (日) 02:24的最新版本

通过向 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 的升级程序重写而导致系统错误。

安装一个扩展

要安装一个 Moodle 的扩展,这个扩这的代码必须部署到 Moodle 内的安装目录下,同时管理员的通知页面必须可见。

管理员页面在英文 Moodle 系统中的访问路径如下:Administration > Site administration > Notifications

有三种方式可以安装 Moodle 扩展到 Moodle 系统中。

从 Moodle 2.5 版本开始,插件可以通过上传到 Moodle 安装实例目录的方式或者通过界面上传 ZIP 包的方式进行上传。

Web 服务器需要具有 Moodle 插件目录的文件写入权限,新扩展的上传可以使用上面提供的 2 种方式的任何一种上传到服务器上。

作为可选方案,你也可以手动部署代码到服务器上。

从 Moodle 的插件目录中直接进行安装

请注意,这种安装方式需要到 Moodle 官方网站上进行插件查找,你可能需要要求注册用户才可以进行访问。

  1. 用管理员登录后,进入目录首页 > 网站管理 > 插件 > 安装扩展 (对应的英文路径为:Administration > Site administration > Plugins > Install add-ons
  2. 单击按钮 '从 Moodle 扩展目录来安装扩展'。
  3. 使用安装按钮来查找一个扩展(例如:2.5 稳定版),然后单击安装按钮继续。
  4. 请确定你是否获得提示信息 '校验已通过!',然后单击按钮 '安装扩展'。

查找和安装的详细办法请参考 OSSEZ 提供的技术指导:从 Moodle 的插件目录中直接进行安装

通过上传 ZIP 文件进行安装

  1. Moodle 插件目录,选择 Moodle 2.5 做为需要下载扩展的版本,然后单击下载来下载 ZIP 包。
  2. 用管理员登录后,进入目录首页 > 网站管理 > 插件 > 安装扩展 (对应的英文路径为:Administration > Site administration > Plugins > Install add-ons)。
  3. 上传 ZIP 文件,选择显示的插件类型,选择相关信息选择框,然后单击 'Install add-on from the ZIP file'按钮。
  4. 请确定你是否获得提示信息 '校验已通过!',然后单击按钮 '安装扩展'。
安装扩展
扩展安装包校验

通过上面 2 种方法,当你单击按钮【安装扩展】,你将会被自动导向到 【首页 > 网站管理 > 插件 > 安装扩展】 (对应的英文路径为:Administration > Site administration > Plugins > Install add-ons)下,然后开始安装过程(例如,创建必须的数据库表等操作)。

在服务器上进行手动安装

如果你不能通过管理员的 Web 界面来安装扩展,你需要将文件手工拷贝到系统上(例如,你不具有服务器上 Moodle 安装目录的)。

首先,需要确认 Moodle 扩展的类型结构。

  • /path/to/moodle/theme/ - 主题
  • /path/to/moodle/mod/ - 活动模块和资源
  • /path/to/moodle/blocks/ - 边栏块
  • /path/to/moodle/question/type/ - 问题类型
  • /path/to/moodle/course/format/ - 课程格式
  • /path/to/moodle/admin/report/ - 管理员报表

请查看 dev:Plugins 来获得所有扩展类型以及他们在 Moodle 网站中的路径。

  1. 进入 Moodle 插件目录,选择 Moodle 2.5 版本,然后选择需要的 Moodle 扩展,然后单击下载按钮下载 ZIP 包。
  2. 上传下载的 ZIP 包到你的 Moodle 服务器上。
  3. 解压 ZIP 包到正确的位置,这个根据扩展的类型不同而不同,或者请参考扩展的帮助手册。
  4. 在你的网站以 Moodle 管理员的身份进入Administration > Site administration > Notifications,你应该看到你安装扩展的类型,同时得到扩展已经安装的消息。

注意:你安装的扩展可能包含了语言文件,这些语言文件可以被你的 Moodle 安装实例自动找到。这些语言文件可以通过: Settings > Site administration > Language编辑界面自定义配置。如果在尝试编辑你的语言文件时候,你得到"数据库错误"的提示信息,这是因为下载语言文件中的 ZIP 包需要被强制修改,很有可能是下载的这个扩展有程序错误。如果你上传 plugin_name/lang/other_language_different_to_English/文件夹,这个数据库错误就会消失的的话,那应该是这个扩展有一个错误语言包的错误,请通知扩展的开发人员,以便于开发人员能在后续版本中进行修复。

解决问题

错误

如果你遇到了错误,请参考打开调试信息来获得更多导致错误的信息。

tool_installaddon/err_curl_exec - cURL error 60
这个问题是需要校验远程(moodle.org)的 SSL 认证信息。这个问题对于运行 Windows 7 的服务器的机器是已知错误,请查看moodle.org 的 SSL 认证来得到更多的信息和可能的解决方案。

当手动进行安装的时候

  • 检查文件的权限。 Web 服务器需要能读取插件文件,如果其他 Moodle 功能正常并能正常工作,请检查插件文件的权限和所属权是否正确。
  • 确认 插件文件的解压和安装都在正确的位置。
  • 因为 Moodle 在插件目录中查找插件,Moodle 将不会扫描其他文件夹。请确认你删除 ZIP 文件而不是将 ZIP 文件重命名,例如将你老版本的插件重命名其他文件名而不删除的话,将会导致错误。
  • 请确认插件的目录名是正确的,所有的名字必须相同,如果你修改名字的话,插件将不会正常工作。

获得帮助

到 Moodle 官方网站社区的 使用 Moodle 版块进行提问。请正确描述的系统(包括 MySQL,PHP 的相关软件的版本),你尝试进行了什么样的操作和你得到了什么样的结果。

请拷贝所有的错误信息。

请提供你尝试安装扩展的版本和你下载插件的地址,很多扩展的名字非常接近。

关于 Moodle 的中文帮助,请参考 OSSEZ 的相关板块 http://www.ossez.com/forum-54-1.html,尽可能的提供详细信息,必要的时候请多截图。

卸载一个扩展

卸载插件

  1. 到路径 Administration> Site Administration > Plugins > Plugins overview 然后单击你希望卸载插件的【卸载】链接按钮。
  2. 使用文件管理员来删除插件目录下的物理文件,否则 Moodle 在你下次访问管理员界面的时候被重新安装。

注意:一些插件类型提供从磁盘中直接删除的功能,但是不是所有的扩展都提供这个功能。

插件概要

插件概要高亮显示了可用的更新和安装按钮

插件摘要界面位于 Administration > Site Administration > Plugins > Plugins overview 路径下,显示了所有已经安装的插件,同时包括版本号,是否可用(启用或者禁用)和设置的链接,如果有这个链接的话。

按钮 '检查可用更新'对管理员可用,被用于快速检查你的插件是否已经有可用的任何更新或者已经安装的更新。任何可用的更新将会被高亮显示,同时也会显示更多的信息和一个下载链接将会在插件的备注栏位中显示。

从 Moodle 中更新插件

从 Moodle 2.4 开始,习惯管理员可以在Administration > Site Administration > Server > Update notifications中启用更新和部署。

当更新可用的时候,'安装这个更新'按钮将会显示在插件预览页面。

查看 自动更新部署 页面来获得更多信息。

禁止你的 Moodle 安装实例安装任何扩展

如果需要,Moodle 扩展的安装和更新可以被完全禁止。

拷贝 config-dist.php 文件中的下面行中的内容到 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: