Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29932

Automated backups assumes users context already exists when processing user files

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Inactive
    • Icon: Minor Minor
    • None
    • 2.1.2
    • Backup
    • None
    • MOODLE_21_STABLE
    • Hide
      1. Create a new course
      2. Upload some users via CSS (do NOT log in as them)
      3. Enrol the new users in the course
      4. Enable automated backups
      5. Browse to /admin/cron.php
      6. Make sure you don't get notices as shown in the description
      Show
      Create a new course Upload some users via CSS (do NOT log in as them) Enrol the new users in the course Enable automated backups Browse to /admin/cron.php Make sure you don't get notices as shown in the description

      While testing MDL-29670 I noted that automated backups assumes a users context exists.
      In my case I had several users uploaded via CSS that have not had contexts created for them yet (never logged in or operated on other than enrolment).
      This led to the following notices popping up:

      Notice: Trying to get property of non-object in /private/var/www/integration/backup/moodle2/backup_stepslib.php on line 1771

      That line of the file is:

      $userctxid = get_context_instance(CONTEXT_USER, $userid)->id;

      and a quick check of the database confirms that several users in the course do not have contexts yet and that upon logging in as them the issue is resolved.

      Cheers
      Sam

            Unassigned Unassigned
            samhemelryk Sam Hemelryk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.