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

get_child_contexts() returns invalid contexts when context path missing

    XMLWordPrintable

Details

    • 4
    • BACKEND Sprint 8

    Description

      This problem was reported by partner. The trouble is that for various reasons the context path may be missing which results in invalid SQL like path selector in get_child_contexts() - we need to verify the path is valid before using it. The problem is that the get_child_contexts() may be used when deleting data which resulted in deletion of all contexts in several existing sites when using some add-ons...

      Short term solution:

      1. print debugging message when get_child_contexts() on contexts that do not have path or depth and return empty array
      2. prevent deleting of system context

      Long term solution (new issue to be created):

      • prevent deleting of invalid contexts in UI
      • add CLI tool for diagnostics and rebuilding of context paths
      • add more debugging notices to inform admins that there is something wrong with contexts
      • add more debugging info for admins that try to insert data directly to database tables without rebuilding the contexts
      • maybe add workaround code for invalid contexts that tries to lookup children using some other info

      Attachments

        Activity

          People

            skodak Petr Skoda
            skodak Petr Skoda
            Rajesh Taneja Rajesh Taneja
            Sam Hemelryk Sam Hemelryk
            Sam Hemelryk Sam Hemelryk
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              13/Jan/14