Debugging 调试:重复输入';1-010';对于键';mdl#u tmpextu mneuse#uix';在穆德尔

Debugging 调试:重复输入';1-010';对于键';mdl#u tmpextu mneuse#uix';在穆德尔,debugging,authentication,ldap,moodle,Debugging,Authentication,Ldap,Moodle,我运行的是/auth/ldap/cli/sync\u users.phpcron脚本,出现以下错误:Debug:key'mdl\u tmpextu\u mneuse\u uix'的重复条目“1-010”。原因可能是什么 有关错误的详细信息: INSERT INTO mdl_tmp_extuser (username,mnethostid) VALUES(?,?) [array ( 0 => '010', 1 => '1', )] Error code: dmlwriteexc

我运行的是
/auth/ldap/cli/sync\u users.php
cron脚本,出现以下错误:Debug:key'mdl\u tmpextu\u mneuse\u uix'的重复条目“1-010”。原因可能是什么

有关错误的详细信息:

INSERT INTO mdl_tmp_extuser (username,mnethostid) VALUES(?,?)
[array (
  0 => '010',
  1 => '1',
)]
Error code: dmlwriteexception
* line 444 of /lib/dml/moodle_database.php: dml_write_exception thrown
* line 1080 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 1043 of /auth/ldap/auth.php: call to mysqli_native_moodle_database->insert_record_raw()
* line 738 of /auth/ldap/auth.php: call to auth_plugin_ldap->ldap_bulk_insert()
* line 63 of /auth/ldap/cli/sync_users.php: call to auth_plugin_ldap->sync_users()

看起来有多个用户使用LDAP系统返回的相同用户名

导致错误的代码是在将此列表与已在Moodle站点注册的现有用户进行比较之前,从LDAP系统中提取所有用户名并将其插入到临时表中的代码


我建议您检查LDAP系统,查看是否有多个用户的用户名(根据错误消息)为“010”。

我已与LDAP服务器进行了检查,并且不应存在重复记录。那么可能的原因是什么呢?临时表是动态创建的吗?临时表在LDAP同步开始时创建,在同步结束时删除。您可能希望向“ldap\u bulk\u insert”函数添加一些代码,以回显“username”字段(或var\u dump插入的对象),然后查看是否与您期望的匹配(例如,用户名“010”是否与您期望的相符,或者是否将错误的字段映射到Moodle username字段?)你能确认你正在使用MySQL作为你的Moodle数据库吗?