moodle-an-hochschulen / moodle-auth_ldap_syncplus

Moodle authentication plugin which provides all functionality of auth_ldap, but supports advanced features for the LDAP synchronization task and LDAP authentication.
GNU General Public License v3.0
10 stars 12 forks source link

SQL error while deleting users #10

Closed Marx1st closed 5 years ago

Marx1st commented 6 years ago

Hi,

we are using Moodle 3.5.2 (Build: 20180910) and auth_ldap_syncplus v3.5-r1 2018062500.

We've suspended all missing users with the plugin and are now trying to delete those. For this we called: php ./admin/tool/task/cli/schedule_task.php --execute=\\auth_ldap_syncplus\\task\\sync_task --showsql --showdebugging

The script quits with the following error (we could delete that user manually, though):

`SELECT * FROM mdl_context WHERE contextlevel = $1 AND instanceid IS NULL [array ( 0 => 50, )]

Query took: 0.0005640983581543 seconds.


SELECT id,category FROM mdl_course WHERE id IS NULL [array ( )]

Query took: 0.0004429817199707 seconds.

... used 27699 dbqueries ... used 27.194963932037 seconds Scheduled task failed: Synchronisierung von LDAP-Nutzerkonten (Sync Plus) (auth_ldap_syncplus\task\sync_task),Datensatz kann nicht in der Datenbanktabelle course gefunden werden Debug info: SELECT id,category FROM {course} WHERE id IS NULL [array ( )] Backtrace:

Any advice?

Regards Tobias

abias commented 5 years ago

Hi Tobias,

I am very sorry that I didn't come back to you before.

I had a look at the problem which you described and think that it's not directly related with auth_ldap_syncplus and can't be solved within the plugin.

If you look at the backtrace (which is read from bottom to top ideally), you will see that auth_ldap_syncplus called delete_user() to delete a user. Afterwards, the user deletion routine within Moodle core tried to clean up several things about the user, including grades. There, as far as I see, an exception happened, probably because there was some inconsistence in your Moodle database. As a result, auth_ldap_syncplus was not able to delete this user and the scheduled task failed.

As this plugin does neither do anything with the mdl_course table nor did it throw the exception which you are posting itself, I am afraid that I have to close this issue as "not a bug".

Hope this helps anyway somehow.

Cheers, Alex