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

Error on tag_cron_task

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.4.1
    • Fix Version/s: 3.3.6, 3.4.3
    • Component/s: Tags
    • Labels:
    • Testing Instructions:
      Hide
      1. Make sure tags are enabled ("Site administration / Advanced features > Enable tags functionality"
      2. Create or edit a course. In the course settings' page add a tag.
      3. Go to a forum activity in the course.
      4. Make a post in a discussion. Make sure to add a tag to the post.
      5. Go to "Site administration / Server / Scheduled tasks"
      6. Run the scheduled task "Background processing for tags"

        php admin/tool/task/cli/schedule_task.php --execute=core\\task\\tag_cron_task
        

      7. Confirm that you don't see any errors.
      Show
      Make sure tags are enabled (" Site administration / Advanced features > Enable tags functionality " Create or edit a course. In the course settings' page add a tag. Go to a forum activity in the course. Make a post in a discussion. Make sure to add a tag to the post. Go to " Site administration / Server / Scheduled tasks " Run the scheduled task "Background processing for tags" php admin/tool/task/cli/schedule_task.php --execute=core\\task\\tag_cron_task Confirm that you don't see any errors.
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull Master Branch:
      wip-MDL-56635-master

      Description

      While trying to run manually the task tag_cron_task in this way:
      php schedule_task.php --execute=\\core\\task
      tag_cron_task

      Getting these errors:
      ++ Did you remember to make the first column something unique in your call to get_records? Duplicate value 'core' found in column 'component'. ++

      • line 1097 of /lib/dml/mysqli_native_moodle_database.php: call to debugging()
      • line 187 of /lib/classes/task/tag_cron_task.php: call to mysqli_native_moodle_database->get_records_sql()
      • line 51 of /lib/classes/task/tag_cron_task.php: call to core\task\tag_cron_task->cleanup()
      • line 137 of /admin/tool/task/cli/schedule_task.php: call to core\task\tag_cron_task->execute()

      While checking the query I've found that it's in cleanup() function and the query is :
      SELECT DISTINCT component, itemtype
      FROM

      {tag_instance}

      WHERE itemtype <> 'user' or component <> 'core'

      on my system this query return :
      ---------------------------+

      component itemtype

      ---------------------------+

      core course
      core course_modules

      ---------------------------+

      As you can see first column is not unique...
      as a workaround I switched column order - not sure that this is the right way, so now my query select :
      SELECT DISTINCT itemtype, component

      and there is no errors..

        Attachments

          Activity

            People

            Assignee:
            marina Marina Glancy
            Reporter:
            yedidia Yedidia Klein
            Peer reviewer:
            Tim Hunt
            Integrator:
            Andrew Nicols
            Tester:
            Janelle Barcega
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/May/18