Moodle
  1. Moodle
  2. MDL-28182

cron is broken when deleting uncompleted users

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1
    • Fix Version/s: 2.0.4, 2.1.1
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide

      see replication instructions

      Show
      see replication instructions
    • Workaround:
      Hide

      The delete_user() needs $user->email and requires $user->auth. But the cronlib selects id and username only.
      So I added them.
      But I don't know how to remove the tailing end of line in the last line, sorry.

      Show
      The delete_user() needs $user->email and requires $user->auth. But the cronlib selects id and username only. So I added them. But I don't know how to remove the tailing end of line in the last line, sorry.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w29_MDL-28182_m22_userdel
    • Rank:
      17891

      Description

      in cron's ourput:

      done.
      Running clean-up tasks...
      PHP Notice: Undefined property: stdClass::$email in /var/www/xxxx/lib/moodlelib.php on line 3516

      Notice: Undefined property: stdClass::$email in /var/www/xxxx/lib/moodlelib.php on line 3516
      PHP Notice: Undefined property: stdClass::$auth in /var/www/xxxx/lib/moodlelib.php on line 3533

      Notice: Undefined property: stdClass::$auth in /var/www/xxxx/lib/moodlelib.php on line 3533

      Default exception handler: Authentication plugin {$a} not found. Debug:

      • line 429 of /lib/setuplib.php: moodle_exception thrown
      • line 3208 of /lib/moodlelib.php: call to print_error()
      • line 3533 of /lib/moodlelib.php: call to get_auth_plugin()
      • line 229 of /lib/cronlib.php: call to delete_user()
      • line 61 of /admin/cli/cron.php: call to cron_run()

      !!! Authentication plugin {$a} not found. !!!
      !! Stack trace: * line 429 of /lib/setuplib.php: moodle_exception thrown

      • line 3208 of /lib/moodlelib.php: call to print_error()
      • line 3533 of /lib/moodlelib.php: call to get_auth_plugin()
      • line 229 of /lib/cronlib.php: call to delete_user()
      • line 61 of /admin/cli/cron.php: call to cron_run()
        !!

      Replication instructions:
      1. $CFG->deleteincompleteusers = 1;
      2. Create an uncompleted user ( confirmed = 1, lastaccess = 1, deleted = 0, email = '' )
      3. run the cron

      I tested it and the patch in 2.0.3 only. And the master is using the same code with 2.0.3

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this.

        Adding more information, such as more detailed replication instructions, screenshots or even a code solution, will help us and other users.

        Show
        Michael de Raadt added a comment - Thanks for reporting this. Adding more information, such as more detailed replication instructions, screenshots or even a code solution, will help us and other users.
        Hide
        Sunner Sun added a comment -

        There already is a replication instruction and a patch. I don't think the screenshots are helpful since the problem only occurs in cron.

        Show
        Sunner Sun added a comment - There already is a replication instruction and a patch. I don't think the screenshots are helpful since the problem only occurs in cron.
        Hide
        Petr Škoda added a comment -

        I have found that the delete_user() function expects full user object (see vent description in lib/db/events.php), I have fixed the phpdocs and updated all places to use '*' instead of the list of columns.

        Thanks a lot for the report and the patch!

        Show
        Petr Škoda added a comment - I have found that the delete_user() function expects full user object (see vent description in lib/db/events.php), I have fixed the phpdocs and updated all places to use '*' instead of the list of columns. Thanks a lot for the report and the patch!
        Hide
        Sam Hemelryk added a comment -

        Thanks guys, this has been integrated now

        Show
        Sam Hemelryk added a comment - Thanks guys, this has been integrated now
        Hide
        Andrew Davis added a comment -

        I'm now getting the below which looks correct. Please be more explicit with the testing instructions.

        Running clean-up tasks...
        Deleted not fully setup user  (5)
        
        Show
        Andrew Davis added a comment - I'm now getting the below which looks correct. Please be more explicit with the testing instructions. Running clean-up tasks... Deleted not fully setup user (5)
        Hide
        Petr Škoda added a comment -

        Thanks everybody, this is now part of the weekly build.

        Show
        Petr Škoda added a comment - Thanks everybody, this is now part of the weekly build.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: