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

Manage repositories error when the context of an instance is missing

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.1, 2.5
    • 2.4.6, 2.5.1, 2.6
    • Repositories
    • MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_26_STABLE
    • MDL-38314-master
    • Hide

      From chat with Eloy:

      1) SELECT contextid FROM mdl_repository_instances
      WHERE NOT EXISTS (SELECT 'x' FROM mdl_context WHERE id = contextid);

      2) That's the list of orphaned repositories in the site

      3) DELETE FROM mdl_repository_instances WHERE contextid = xxxxx

      note that the 1037 should appear in the list produced by 1).

      Show
      From chat with Eloy: 1) SELECT contextid FROM mdl_repository_instances WHERE NOT EXISTS (SELECT 'x' FROM mdl_context WHERE id = contextid); 2) That's the list of orphaned repositories in the site 3) DELETE FROM mdl_repository_instances WHERE contextid = xxxxx note that the 1037 should appear in the list produced by 1).
    • Hide

      Upgrade test

      This upgrade test has to be done on all supported DB engines

      1. Enable Flickr Public repository
      2. Create a User instance of that repository in a new user account
      3. Create a Course instance of that repository in a new course
      4. Delete the user
      5. Delete the course
      6. Visit Home / Site administration / Plugins / Repositories / Manage repositories
        • Make sure you SEE errors
      7. Upgrade to the latest
      8. Visit Home / Site administration / Plugins / Repositories / Manage repositories
        • Make sure you DO NOT see any errors

      Test pre-requisites

      • Enable the File System repository with Course/User instances allowed
      • Create the folders
        • $dataroot/repository/course
        • $dataroot/repository/user
      • Place a different picture in each folder
      • Create a new course (C1)
      • Create a new course (C2)
      • Create a new user (U1)
      • Make U1 an admin so it has all the capabilities

      Test preparation

      1. Login as U1
      2. Go to C1
      3. Navigate to Home / Courses / Miscellaneous / C1 / Repositories / Course repositories
      4. Create a File System instance using the folder course (call it FS Course)
      5. Add a file module to the course (call it 'Please pick me')
        • As content, place a alias/shortcut of the image in FS Course
      1. Navigate to Home / My profile / Repositories / U1 / Repositories
      2. Create a File System instance using the folder user (call it FS User)
      1. Navigate to C2
      2. Create a file activity called 'Reference to User repo'
        • As a content, place a alias/shortcut of the image in FS User
      3. Create another file activity called 'Reference to Course repo'
        • As a content, browse 'Server files' up to the course C1
        • Pick an alias/shortcut of the image in 'Please pick me' file module.

      Test steps

      1. Login as admin
      2. Go to C2 and confirm that both file resources contain alias/shortcuts
        • One to FS User
        • Another one to FS Course
      3. Delete the user U1
        • Make sure the FS User entry in mdl_repository_instances is deleted
        • Make sure the file in module 'Reference to a User repo' in C2 is now a real copy
      4. Delete the course C1
        • Make sure the FS Course entry in mdl_repository_instances is deleted
        • Make sure the file in module 'Reference to a Course repo' in C2 is now a real copy
      5. Visit Home / Site administration / Plugins / Repositories / Manage repositories
        • Make sure you don't see any errors
      Show
      Upgrade test This upgrade test has to be done on all supported DB engines Enable Flickr Public repository Create a User instance of that repository in a new user account Create a Course instance of that repository in a new course Delete the user Delete the course Visit Home / Site administration / Plugins / Repositories / Manage repositories Make sure you SEE errors Upgrade to the latest Visit Home / Site administration / Plugins / Repositories / Manage repositories Make sure you DO NOT see any errors Test pre-requisites Enable the File System repository with Course/User instances allowed Create the folders $dataroot/repository/course $dataroot/repository/user Place a different picture in each folder Create a new course (C1) Create a new course (C2) Create a new user (U1) Make U1 an admin so it has all the capabilities Test preparation Login as U1 Go to C1 Navigate to Home / Courses / Miscellaneous / C1 / Repositories / Course repositories Create a File System instance using the folder course (call it FS Course) Add a file module to the course (call it 'Please pick me') As content, place a alias/shortcut of the image in FS Course Navigate to Home / My profile / Repositories / U1 / Repositories Create a File System instance using the folder user (call it FS User) Navigate to C2 Create a file activity called 'Reference to User repo' As a content, place a alias/shortcut of the image in FS User Create another file activity called 'Reference to Course repo' As a content, browse 'Server files' up to the course C1 Pick an alias/shortcut of the image in 'Please pick me' file module. Test steps Login as admin Go to C2 and confirm that both file resources contain alias/shortcuts One to FS User Another one to FS Course Delete the user U1 Make sure the FS User entry in mdl_repository_instances is deleted Make sure the file in module 'Reference to a User repo' in C2 is now a real copy Delete the course C1 Make sure the FS Course entry in mdl_repository_instances is deleted Make sure the file in module 'Reference to a Course repo' in C2 is now a real copy Visit Home / Site administration / Plugins / Repositories / Manage repositories Make sure you don't see any errors
    • BACKEND Sprint 2

    Description

      In admin/repository.php:

      Can not find data record in database table context.

      Debug info: SELECT * FROM

      {context}

      WHERE id = ?
      [array (
      0 => '1037',
      )]
      Error code: invalidrecord
      Stack trace:

      line 1357 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1333 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 5137 of /lib/accesslib.php: call to moodle_database->get_record()
      line 504 of /repository/lib.php: call to context::instance_by_id()
      line 61 of /repository/flickr_public/lib.php: call to repository->__construct()
      line 934 of /repository/lib.php: call to repository_flickr_public->__construct()
      line ? of unknownfile: call to repository::get_instances()
      line 1047 of /repository/lib.php: call to call_user_func_array()
      line 312 of /admin/repository.php: call to repository::static_function()

      Attachments

        Issue Links

          Activity

            People

              fred Frédéric Massart
              tsala Helen Foster
              Mark Nelson Mark Nelson
              Damyon Wiese Damyon Wiese
              David Monllaó David Monllaó
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              7 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8/Jul/13