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

Indexing of personal messages of meanwhile deleted user does not fail gracefully

    XMLWordPrintable

    Details

    • Database:
      Any
    • Testing Instructions:
      Hide

      Steps to reproduce:

      • Create a Moodle instance with two users in the same course
      • Make sure that global search is properly set up and that the "Messages - received" and "Messages - sent" search areas are active
      • Have the first user send the second a message
      • Have the second user respond to the first user message
      • Delete the first user
      • Run the site index task (/search/cli/indexer.php)

      Expected result:

      • The message exchange with the deleted user shouldn't be indexed.
      • This is the same behavior as prior to the patch, however, an exception isn't thrown anymore.
      Show
      Steps to reproduce: Create a Moodle instance with two users in the same course Make sure that global search is properly set up and that the "Messages - received" and "Messages - sent" search areas are active Have the first user send the second a message Have the second user respond to the first user message Delete the first user Run the site index task (/search/cli/indexer.php) Expected result: The message exchange with the deleted user shouldn't be indexed. This is the same behavior as prior to the patch, however, an exception isn't thrown anymore.
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL_59834-Indexing_of_personal_messages

      Description

      This was reported first on https://github.com/catalyst/moodle-search_elastic/issues/27 as a bug of the search_elastic plugin, but was identified as a Moodle core bug by Matt Porritt.

      Steps to reproduce:

      • Create a Moodle instance with two users in the same course
      • Make sure that global search is properly set up and that the "Messages - received" and "Messages - sent" search areas are active
      • Have the first user send the second a message
      • Have the second user respond to the first user message
      • Delete the first user
      • Run the site index task (/search/cli/indexer.php)

      Expected result:

      • The message exchange with the deleted user shouldn't be indexed.

      Actual result:

      • Indexing the message fails quite ungracefully with a debug trace:

        ++ Error retrieving core_message-message_received 1 document, not all required data is available: Invalid user ++
        * line 59 of /message/classes/search/base_message.php: call to debugging()
        * line 62 of /message/classes/search/message_received.php: call to core_message\search\base_message->get_document()
        * line ? of unknownfile: call to core_message\search\message_received->get_document()
        * line 103 of /lib/classes/dml/recordset_walk.php: call to call_user_func()
        * line 382 of /search/engine/elastic/classes/engine.php: call to core\dml\recordset_walk->current()
        * line 666 of /search/classes/manager.php: call to search_elastic\engine->add_documents()
        * line 93 of /search/cli/indexer.php: call to core_search\manager->index()
         Processed 1 records containing 1 documents, in 0.028 seconds.
        

      Matt Porritt's guess was that \core_message\message_sent get_document() needs to be modified to deal with missing users.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Sep/17