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

DB error in communication due to incorrect provider switching in groups mode

XMLWordPrintable

    • MOODLE_404_STABLE
    • MOODLE_404_STABLE
    • MDL-81595-main
    • Hide

      Setup

      1. Clone Andrew's helper repository:

        git clone https://github.com/andrewnicols/moodle-synapse
        cd moodle-synapse
        chmod 777 *_data
        

      2. Run the docker-compose up command:

        docker compose up -d
        

      3. Wait for about 10 seconds for the first run to complete
      4. Run the setup script:

        ./setup.sh
        

      5. Copy the command it outputs
      6. Change into your Moodle directory
      7. Paste in the command, for EXAMPLE:

        cd path/to/moodle
        sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php
        cd -
        

      8. If you have not done so already, edit your /etc/hosts file to add:

        127.0.0.1 element.container.docker.internal element
        127.0.0.1 synapse.container.docker.internal synapse
        127.0.0.1 keycloak.container.docker.internal keycloak
        

      9. Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this.

      Test scenario

      1. Enable the Matrix communication provider on a course, running cron etc so everything is set up and active.
      2. Set up 2 groups and add some users to them.
      3. Switch the course to visible groups. Run cron again so comm/matrix is updated.
      4. Switch the provider on the course to custom link. Save and run cron.
      5. Confirm that there is no error from the communication related ad-hoc tasks.
      6. Navigate back to communication settings page for the course.
      7. Confirm that the communication provider is custom link.

       

      Show
      Setup Clone Andrew's helper repository: git clone https://github.com/andrewnicols/moodle-synapse cd moodle-synapse chmod 777 *_data Run the docker-compose up command: docker compose up -d Wait for about 10 seconds for the first run to complete Run the setup script: ./setup.sh Copy the command it outputs Change into your Moodle directory Paste in the command, for EXAMPLE : cd path/to/moodle sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php cd - If you have not done so already, edit your /etc/hosts file to add: 127.0.0.1 element.container.docker.internal element 127.0.0.1 synapse.container.docker.internal synapse 127.0.0.1 keycloak.container.docker.internal keycloak Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this. Test scenario Enable the Matrix communication provider on a course, running cron etc so everything is set up and active. Set up 2 groups and add some users to them. Switch the course to visible groups. Run cron again so comm/matrix is updated. Switch the provider on the course to custom link. Save and run cron. Confirm that there is no error from the communication related ad-hoc tasks. Navigate back to communication settings page for the course. Confirm that the communication provider is custom link.  
    • Team Hedgehog 2024 Sprint 1.4

      When you have groups mode enabled,  mdl_communication  has one instance active for the course, plus n instances for each group, for example 2 groups will have 3 instances (2x groups and 1x course).

      The issue is that when you switch providers (eg matrix to custom link), the correct instances are created/enabled, however only the groups instances are disabled, the course level instance for the disabled provider is still active. The result is that when you visit the communication settings page again, you will throw a database error due to multiple rows being returned when one is expected, which also results in the wrong provider being displayed. This cannot be fixed by simply disabling communication on the course, as that does not change the active status of the row that was expected to be inactive already.

      Steps to reproduce (assumes Synapse is set up and running):

      1. Enable communication on the site.
      2. Enable the Matrix communication provider on a course, running cron etc so everything is set up and active.
      3. Set up 2 groups and add some users to them.
      4. Switch the course to visible groups. Run cron again so comm/matrix is updated.
      5. Switch the provider on the course to custom link. Save and run cron.
      6. Navigate back to the communication page -> you will see a database error, and potentially the Matrix comm info will be loaded instead of custom link.

      The database error is as follows:

      Error: mdb->get_record() found more than one record!
          line 1696 of /lib/dml/moodle_database.php: call to debugging()
          line 1656 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
          line 1635 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 393 of /communication/classes/processor.php: call to moodle_database->get_record()
          line 71 of /communication/classes/api.php: call to core_communication\processor::load_by_instance()
          line 97 of /communication/classes/api.php: call to core_communication\api->__construct()
          line 65 of /communication/classes/helper.php: call to core_communication\api::load_by_instance()
          line 445 of /course/edit_form.php: call to core_communication\helper::load_by_course()
          line 217 of /lib/formslib.php: call to course_edit_form->definition()
          line 153 of /course/edit.php: call to moodleform->__construct() 

       

            safat.shahin@moodle.com Safat Shahin
            michaelh Michael Hawkins
            Michael Hawkins Michael Hawkins
            Huong Nguyen Huong Nguyen
            Meirza Meirza
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 5 hours, 30 minutes
                1d 5h 30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.