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

Fix uses of delete_record(s) within one condition

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.0.3, 2.1
    • None
    • Database SQL/XMLDB
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • Easy

    Description

      Since Moodle 2.0, the $DB->delete_records() method always return true. If some problem is found, it throws exception.

      So code like this:

      if ($DB->delete_records($table, $params)) {
          // Conditional code here
      ...

      Has no sense at all. Review all the current uses and change them to be linear / add extra checks if needed.

      Tip: grep -r "if" * | grep delete_records

      Ciao

      Attachments

        Activity

          People

            Unassigned Unassigned
            stronk7 Eloy Lafuente (stronk7)
            David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: