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

Deprecation of sql_select_reader completely breaks code that uses it

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.9, 3.0
    • Fix Version/s: 2.9.1
    • Component/s: Logging
    • Testing Instructions:
      Hide

      Test 1

      1. Set debug mode to dev level
      2. Install https://github.com/mudrd8mz/moodle-report_overviewstats/tree/release-v1.2 (see that it is not master but release-v1.2 tag)
      3. Go to site admin -> reports -> overview statistics
      4. You SHOULD see a debugging message about using a deprecated interface
      5. You SHOULD NOT see a fatal error
      6. Data SHOULD be displayed

      Test 2

      1. Create a logstore plugin implementing \core\log\sql_internal_reader, install it and then enable it (I've copied and edited the current standard but replacing sql_internal_reader because I haven't found anything in the plugins database)
      2. cd report/overviewstats && git checkout master
      3. Go to site admin -> reports -> overview statistics
      4. You SHOULD see a debugging message about your new logstore plugin
      Show
      Test 1 Set debug mode to dev level Install https://github.com/mudrd8mz/moodle-report_overviewstats/tree/release-v1.2 (see that it is not master but release-v1.2 tag) Go to site admin -> reports -> overview statistics You SHOULD see a debugging message about using a deprecated interface You SHOULD NOT see a fatal error Data SHOULD be displayed Test 2 Create a logstore plugin implementing \core\log\sql_internal_reader, install it and then enable it (I've copied and edited the current standard but replacing sql_internal_reader because I haven't found anything in the plugins database) cd report/overviewstats && git checkout master Go to site admin -> reports -> overview statistics You SHOULD see a debugging message about your new logstore plugin
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50408_master
    • Sprint:
      Team Beards Sprint 7

      Description

      Some code taken from https://github.com/mudrd8mz/moodle-report_overviewstats.git

      $logmanger = get_log_manager();
      $readers = $logmanger->get_readers('\core\log\sql_select_reader');
      

      From lib/upgrade.txt

      • sql_internal_reader and sql_select_reader interfaces have been deprecated in favour of sql_internal_table_reader
        and sql_reader which use iterators to be more memory efficient.

      \core\log\sql_select_reader has been deprecated in favour of \core\log\sql_reader.

      The problem is that get_readers() now returns an empty array. No deprecation warning telling you to update the code, it doesn't return the old class but it also doesn't give me the new class, just an empty array. So even though the class has been deprecated rather than outright removed the code that uses it is entirely broken without any clue as to why exactly.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  6/Jul/15