FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

enrol.php: only match relevant users in enrol.php #112

Closed danpoltawski closed 9 years ago

danpoltawski commented 9 years ago

When you use tool_generator to create users, their username ends up being something like tool_generator_001000 and here we try to enrol anyone with the username beginning with t, which can take a long time when you've created 100,000 users...

You can test this by using tool_generator to create any sized course.

FMCorz commented 9 years ago

Not sure I agree that ALL accounts BUT the ones matching s/m/t0-9 should be allowed, with auth_mdk you can create other accounts which also start with a letter but might be longer. This patch would also create a regression for those who use accounts such as teacher, or student.

I would argue against the strictness and just skip the accounts named after the tool generator.

danpoltawski commented 9 years ago

I agree with any solution which gets the bug fixed soon. :8ball: (I was going to file a bug, but thought I am always filing bugs and never creating fixes..)

Perhaps you can describe the scripts more - not able to read your mind about the expected intentions. I took the approach that I assumed it was a counterpart to users.php.

with auth_mdk you can create other accounts which also start with a letter but might be longer.

Not sure I understand whether you want it to match them or not - but it will match 'longer' numbers - note the '+'.

This patch would also create a regression for those who use accounts such as teacher, or student.

Sure, your regression is my feature because it doesn't seem like thats the intention of the script.

FMCorz commented 9 years ago

Thanks, I've added a quick dirty fix to ignore the toolgenerator% users. Cheers.