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

tag/lib.php todo: Update tag cleanup sql so that it supports multiple types of tags

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: Tags
    • Labels:

      Description

      This issue is creating an associated MDL for an orphan TODO in tag/lib.php, which I came across while working on [MDL-30992]...

      tag/lib.php

          // TODO MDL-31212 this will only clean tags of type 'default'.  This is good as
          // it won't delete 'official' tags, but the day we get more than two
          // types, we need to fix this.
          $unused_tags = $DB->get_recordset_sql("SELECT tg.id
                                                   FROM {tag} tg
                                                  WHERE tg.tagtype = 'default'
                                                        AND NOT EXISTS (
                                                            SELECT 'x'
                                                              FROM {tag_instance} ti
                                                             WHERE ti.tagid = tg.id
                                                        )");

      The above code is an extract from the tag_cleanup() function in tag/lib.php. It suggests we update the SQL here to support multiple types of tags, as soon as the need arises in the future. However for a superficial view of this issue, it appears to me that changing the appropriate section of the WHERE to the following, would address this issue:
      WHERE tg.tagtype <> 'official'

      The code was last touched by scyrma (Mathieu)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gerry Gerard Caulfield
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: