Moodle
  1. Moodle
  2. MDL-32265

Small patch to greatly reduce the number of database queries on the front page for administrators

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.3
    • Component/s: Libraries
    • Labels:
    • Rank:
      39054

      Description

      While working on a navigation issue I noticed that the function moodle_needs_upgrading() was making hundreds of calls to get_config for plugins, which in turn was leading to hundreds of database queries.
      I had a quick look at the code and think there is a pretty easy solution to reduce that hundreds of queries to a single query.
      I've created a branch and will put this up for peer-review now.

      Please note it only effects those with the moodle/site:config and only where moodle_needs_upgrading(). Pretty much site front page and admin/index.php are the main two.

      Cheers
      Sam

        Activity

        Hide
        Sam Hemelryk added a comment -

        Up for peer-review

        Show
        Sam Hemelryk added a comment - Up for peer-review
        Hide
        Dan Poltawski added a comment -

        Looks good - get_config a great target for MUC eh?

        Show
        Dan Poltawski added a comment - Looks good - get_config a great target for MUC eh?
        Hide
        Sam Hemelryk added a comment -

        Thanks Dan, submitting for integration now.
        get_config when provided with a plugin name probably would be a great area to look at for shared caching.

        Cheers
        Sam

        Show
        Sam Hemelryk added a comment - Thanks Dan, submitting for integration now. get_config when provided with a plugin name probably would be a great area to look at for shared caching. Cheers Sam
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated, thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Passed all the steps. So passing this, thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - Passed all the steps. So passing this, thanks!
        Hide
        Aparup Banerjee added a comment -

        The code here has been spread to upstream moodle repositories and mirrors for anyone to use .

        Closing, have a good weekend!

        Show
        Aparup Banerjee added a comment - The code here has been spread to upstream moodle repositories and mirrors for anyone to use . Closing, have a good weekend!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: