\claroline\inc\lib\module\manage.lib.php
1、安装:function install_module()(1)检查参数:readModuleManifest()
(2)检查重复的模块:check if a module with the same LABEL is already installed, if yes, we cancel everything
(3)保存到数据库,要考虑tool和dock的区别: Save the module information into DB
(4)重命名模块文件:Rename the module repository with label
(5)安装setup目录下的install.sql和install.php。Include the local 'install.sql' and 'install.php' file of the module if they exis
对于tool类型的模块,还要在coures中注册。
(6)更新模块的缓存:cache file with the module's include must be renewed after installation of the module
(7)根据默认的def/conf生成conf文件,generate the conf if a def file exists
2、卸载:uninstall_module()(1)从平台反激活该模块:deactivate the module
(2)从cours_tools数据库中删除:delete the module in the cours_tool table, used for every course creation
(3)取得模块信息:find info about the module to uninstall
(4)运行setup/目录下的uninstall.sql和uninstall.php,注意是先运行uninstall.php,再运行uninstall.sql:Include the local 'uninstall.sql' and 'uninstall.php' file of the module if they exist
(5)删除模块相关的目录和文件:delete related files and folders
(6)从课程的couse_tool和主数据表中删除模块信息:delete related entries in main DB
(7)修改权限表,包括read和write权限,
(8)把所有相关的dock删除:remove all docks entries in which the module displays
(9)更新缓存:cache file with the module's include must be renewed after uninstallation of the module
3、课程中模块表的处理(1)setup中的表:couse_install.sql和couse_uninstall.sql
(2)引用:
- \claroline\inc\claro_init_global.inc.php:
if ( claro_is_in_a_course()
&& ! is_module_installed_in_course( $tlabelReq, claro_get_current_course_id() ) )
{
install_module_database_in_course( $tlabelReq, claro_get_current_course_id() ) ;
} - \claroline\inc\lib\module.lib.php
function install_module_in_course( $moduleLabel, $courseId )
$sql = str_replace ('__CL_MAIN__',get_conf('mainTblPrefix'), $sql);
4、BUG:删除模块的时候,课程中的数据表不删除原因:uninstall_module中,先调用了unregister_module_from_courses函数,把模块从课程中取消,unregister_module_from_courses对每个课程都调用unregister_module_from_single_course函数,逐个课程删除模块,但是在unregister_module_from_single_course中,只把课程中的模块信息删除,没有对该课程下的模块数据表进行删除。所以应该在unregister_module_from_single_course()函数中加入:
$module_lable = get_module_label_list(); delete_module_in_course($module_lable[$tool_id],$course_code);
|
阅读(2166) | 评论(0) | 转发(0) |