使用在moodle中提供的XMLDB编辑器,我为自定义块创建了以下模式:
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="blocks/userlist/db" VERSION="20190504" COMMENT="XMLDB file for Moodle blocks/userlist"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="block_userlist" COMMENT="Statistics on user Activity.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="logout_time" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Time that a user logs out."/>
<FIELD NAME="login_time" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time that a user has logged in"/>
<FIELD NAME="session_duration" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="How long that a user has logged in"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="foreign" FIELDS="id" REFTABLE="user" REFFIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
并且我想将其加载到我当前的情绪安装的数据库中,以便在其中进行操作。因此,我想问一下该怎么做?
我查看了https://docs.moodle.org/dev/Using_XMLDB#Create_new_table,但看不到应用架构更改的方法。此外,我查看了数据库的表,以查明该表是否已创建但似乎没有:
| m_analytics_indicator_calc |
| m_analytics_models |
| m_analytics_models_log |
| m_analytics_predict_samples |
| m_analytics_prediction_actions |
| m_analytics_predictions |
| m_analytics_train_samples |
| m_analytics_used_analysables |
| m_analytics_used_files |
| m_assign |
| m_assign_grades |
| m_assign_overrides |
| m_assign_plugin_config |
| m_assign_submission |
| m_assign_user_flags |
| m_assign_user_mapping |
| m_assignfeedback_comments |
| m_assignfeedback_editpdf_annot |
| m_assignfeedback_editpdf_cmnt |
| m_assignfeedback_editpdf_queue |
| m_assignfeedback_editpdf_quick |
| m_assignfeedback_file |
| m_assignment |
| m_assignment_submissions |
| m_assignment_upgrade |
| m_assignsubmission_file |
| m_assignsubmission_onlinetext |
| m_auth_oauth2_linked_login |
| m_backup_controllers |
| m_backup_courses |
| m_backup_logs |
| m_badge |
| m_badge_backpack |
| m_badge_competencies |
| m_badge_criteria |
| m_badge_criteria_met |
| m_badge_criteria_param |
| m_badge_endorsement |
| m_badge_external |
| m_badge_issued |
| m_badge_manual_award |
| m_badge_related |
| m_block |
| m_block_community |
| m_block_instances |
| m_block_positions |
| m_block_recent_activity |
| m_block_recentlyaccesseditems |
| m_block_rss_client |
| m_blog_association |
| m_blog_external |
| m_book |
| m_book_chapters |
| m_cache_filters |
| m_cache_flags |
| m_capabilities |
| m_chat |
| m_chat_messages |
| m_chat_messages_current |
| m_chat_users |
| m_choice |
| m_choice_answers |
| m_choice_options |
| m_cohort |
| m_cohort_members |
| m_comments |
| m_competency |
| m_competency_coursecomp |
| m_competency_coursecompsetting |
| m_competency_evidence |
| m_competency_framework |
| m_competency_modulecomp |
| m_competency_plan |
| m_competency_plancomp |
| m_competency_relatedcomp |
| m_competency_template |
| m_competency_templatecohort |
| m_competency_templatecomp |
| m_competency_usercomp |
| m_competency_usercompcourse |
| m_competency_usercompplan |
| m_competency_userevidence |
| m_competency_userevidencecomp |
| m_config |
| m_config_log |
| m_config_plugins |
| m_context |
| m_context_temp |
| m_course |
| m_course_categories |
| m_course_completion_aggr_methd |
| m_course_completion_crit_compl |
| m_course_completion_criteria |
| m_course_completion_defaults |
| m_course_completions |
| m_course_format_options |
| m_course_modules |
| m_course_modules_completion |
| m_course_published |
| m_course_request |
| m_course_sections |
| m_data |
| m_data_content |
| m_data_fields |
| m_data_records |
| m_editor_atto_autosave |
| m_enrol |
| m_enrol_flatfile |
| m_enrol_lti_lti2_consumer |
| m_enrol_lti_lti2_context |
| m_enrol_lti_lti2_nonce |
| m_enrol_lti_lti2_resource_link |
| m_enrol_lti_lti2_share_key |
| m_enrol_lti_lti2_tool_proxy |
| m_enrol_lti_lti2_user_result |
| m_enrol_lti_tool_consumer_map |
| m_enrol_lti_tools |
| m_enrol_lti_users |
| m_enrol_paypal |
| m_event |
| m_event_subscriptions |
| m_events_handlers |
| m_events_queue |
| m_events_queue_handlers |
| m_external_functions |
| m_external_services |
| m_external_services_functions |
| m_external_services_users |
| m_external_tokens |
| m_favourite |
| m_feedback |
| m_feedback_completed |
| m_feedback_completedtmp |
| m_feedback_item |
| m_feedback_sitecourse_map |
| m_feedback_template |
| m_feedback_value |
| m_feedback_valuetmp |
| m_file_conversion |
| m_files |
| m_files_reference |
| m_filter_active |
| m_filter_config |
| m_folder |
| m_forum |
| m_forum_digests |
| m_forum_discussion_subs |
| m_forum_discussions |
| m_forum_posts |
| m_forum_queue |
| m_forum_read |
| m_forum_subscriptions |
| m_forum_track_prefs |
| m_glossary |
| m_glossary_alias |
| m_glossary_categories |
| m_glossary_entries |
| m_glossary_entries_categories |
| m_glossary_formats |
| m_grade_categories |
| m_grade_categories_history |
| m_grade_grades |
| m_grade_grades_history |
| m_grade_import_newitem |
| m_grade_import_values |
| m_grade_items |
| m_grade_items_history |
| m_grade_letters |
| m_grade_outcomes |
| m_grade_outcomes_courses |
| m_grade_outcomes_history |
| m_grade_settings |
| m_grading_areas |
| m_grading_definitions |
| m_grading_instances |
| m_gradingform_guide_comments |
| m_gradingform_guide_criteria |
| m_gradingform_guide_fillings |
| m_gradingform_rubric_criteria |
| m_gradingform_rubric_fillings |
| m_gradingform_rubric_levels |
| m_groupings |
| m_groupings_groups |
| m_groups |
| m_groups_members |
| m_imscp |
| m_label |
| m_lesson |
| m_lesson_answers |
| m_lesson_attempts |
| m_lesson_branch |
| m_lesson_grades |
| m_lesson_overrides |
| m_lesson_pages |
| m_lesson_timer |
| m_license |
| m_lock_db |
| m_log |
| m_log_display |
| m_log_queries |
| m_logstore_standard_log |
| m_lti |
| m_lti_submission |
| m_lti_tool_proxies |
| m_lti_tool_settings |
| m_lti_types |
| m_lti_types_config |
| m_ltiservice_gradebookservices |
| m_message |
| m_message_airnotifier_devices |
| m_message_contact_requests |
| m_message_contacts |
| m_message_conversation_members |
| m_message_conversations |
| m_message_popup |
| m_message_popup_notifications |
| m_message_processors |
| m_message_providers |
| m_message_read |
| m_message_user_actions |
| m_message_users_blocked |
| m_messageinbound_datakeys |
| m_messageinbound_handlers |
| m_messageinbound_messagelist |
| m_messages |
| m_mnet_application |
| m_mnet_host |
| m_mnet_host2service |
| m_mnet_log |
| m_mnet_remote_rpc |
| m_mnet_remote_service2rpc |
| m_mnet_rpc |
| m_mnet_service |
| m_mnet_service2rpc |
| m_mnet_session |
| m_mnet_sso_access_control |
| m_mnetservice_enrol_courses |
| m_mnetservice_enrol_enrolments |
| m_modules |
| m_my_pages |
| m_notifications |
| m_oauth2_access_token |
| m_oauth2_endpoint |
| m_oauth2_issuer |
| m_oauth2_system_account |
| m_oauth2_user_field_mapping |
| m_page |
| m_portfolio_instance |
| m_portfolio_instance_config |
| m_portfolio_instance_user |
| m_portfolio_log |
| m_portfolio_mahara_queue |
| m_portfolio_tempdata |
| m_post |
| m_profiling |
| m_qtype_ddimageortext |
| m_qtype_ddimageortext_drags |
| m_qtype_ddimageortext_drops |
| m_qtype_ddmarker |
| m_qtype_ddmarker_drags |
| m_qtype_ddmarker_drops |
| m_qtype_essay_options |
| m_qtype_match_options |
| m_qtype_match_subquestions |
| m_qtype_multichoice_options |
| m_qtype_randomsamatch_options |
| m_qtype_shortanswer_options |
| m_question |
| m_question_answers |
| m_question_attempt_step_data |
| m_question_attempt_steps |
| m_question_attempts |
| m_question_calculated |
| m_question_calculated_options |
| m_question_categories |
| m_question_dataset_definitions |
| m_question_dataset_items |
| m_question_datasets |
| m_question_ddwtos |
| m_question_gapselect |
| m_question_hints |
| m_question_multianswer |
| m_question_numerical |
| m_question_numerical_options |
| m_question_numerical_units |
| m_question_response_analysis |
| m_question_response_count |
| m_question_statistics |
| m_question_truefalse |
| m_question_usages |
| m_quiz |
| m_quiz_attempts |
| m_quiz_feedback |
| m_quiz_grades |
| m_quiz_overrides |
| m_quiz_overview_regrades |
| m_quiz_reports |
| m_quiz_sections |
| m_quiz_slot_tags |
| m_quiz_slots |
| m_quiz_statistics |
| m_rating |
| m_registration_hubs |
| m_repository |
| m_repository_instance_config |
| m_repository_instances |
| m_repository_onedrive_access |
| m_resource |
| m_resource_old |
| m_role |
| m_role_allow_assign |
| m_role_allow_override |
| m_role_allow_switch |
| m_role_allow_view |
| m_role_assignments |
| m_role_capabilities |
| m_role_context_levels |
| m_role_names |
| m_role_sortorder |
| m_scale |
| m_scale_history |
| m_scorm |
| m_scorm_aicc_session |
| m_scorm_scoes |
| m_scorm_scoes_data |
| m_scorm_scoes_track |
| m_scorm_seq_mapinfo |
| m_scorm_seq_objective |
| m_scorm_seq_rolluprule |
| m_scorm_seq_rolluprulecond |
| m_scorm_seq_rulecond |
| m_scorm_seq_ruleconds |
| m_search_index_requests |
| m_search_simpledb_index |
| m_sessions |
| m_stats_daily |
| m_stats_monthly |
| m_stats_user_daily |
| m_stats_user_monthly |
| m_stats_user_weekly |
| m_stats_weekly |
| m_survey |
| m_survey_analysis |
| m_survey_answers |
| m_survey_questions |
| m_tag |
| m_tag_area |
| m_tag_coll |
| m_tag_correlation |
| m_tag_instance |
| m_task_adhoc |
| m_task_scheduled |
| m_tool_cohortroles |
| m_tool_customlang |
| m_tool_customlang_components |
| m_tool_dataprivacy_category |
| m_tool_dataprivacy_ctxexpired |
| m_tool_dataprivacy_ctxinstance |
| m_tool_dataprivacy_ctxlevel |
| m_tool_dataprivacy_purpose |
| m_tool_dataprivacy_purposerole |
| m_tool_dataprivacy_request |
| m_tool_monitor_events |
| m_tool_monitor_history |
| m_tool_monitor_rules |
| m_tool_monitor_subscriptions |
| m_tool_policy |
| m_tool_policy_acceptances |
| m_tool_policy_versions |
| m_tool_recyclebin_category |
| m_tool_recyclebin_course |
| m_tool_usertours_steps |
| m_tool_usertours_tours |
| m_upgrade_log |
| m_url |
| m_user |
| m_user_devices |
| m_user_enrolments |
| m_user_info_category |
| m_user_info_data |
| m_user_info_field |
| m_user_lastaccess |
| m_user_password_history |
| m_user_password_resets |
| m_user_preferences |
| m_user_private_key |
| m_wiki |
| m_wiki_links |
| m_wiki_locks |
| m_wiki_pages |
| m_wiki_subwikis |
| m_wiki_synonyms |
| m_wiki_versions |
| m_workshop |
| m_workshop_aggregations |
| m_workshop_assessments |
| m_workshop_grades |
| m_workshop_submissions |
| m_workshopallocation_scheduled |
| m_workshopeval_best_settings |
| m_workshopform_accumulative |
| m_workshopform_comments |
| m_workshopform_numerrors |
| m_workshopform_numerrors_map |
| m_workshopform_rubric |
| m_workshopform_rubric_config |
| m_workshopform_rubric_levels |
答案 0 :(得分:1)
将其放在自定义插件的db /子文件夹中,然后访问Moodle站点的“通知”页面以触发插件的安装(如果使用XMLDB编辑器创建该插件,则该插件应位于正确的位置它)。
如果已经安装了插件,则可以通过站点管理员>插件>管理插件来卸载插件(这不会删除代码,但会删除与该插件关联的所有数据)。卸载完成后,单击“继续”,并假设您尚未删除插件的代码,Moodle会将其识别为新插件并与数据库表一起安装。
另一种选择是使用XMLDB编辑器生成进入db / upgrade.php所需的升级步骤,提高插件版本号并触发升级。
有关更多详细信息,请参见https://docs.moodle.org/dev/Upgrade_API。