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

get_child_contexts() returns invalid contexts when context path missing

    XMLWordPrintable

    Details

    • Story Points:
      4
    • Sprint:
      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

            • Assignee:
              skodak Petr Skoda
              Reporter:
              skodak Petr Skoda
              Peer reviewer:
              Rajesh Taneja
              Integrator:
              Sam Hemelryk
              Tester:
              Sam Hemelryk
              Participants:
              Component watchers:
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jan/14