original_string: private function migrate_notification($notification, $isread) {
          global $DB;
  
          $tabledata = new \stdClass();
          $tabledata->useridfrom = $notification->useridfrom;
          $tabledata->useridto = $notification->useridto;
          $tabledata->subject = $notification->subject;
          $tabledata->fullmessage = $notification->fullmessage;
          $tabledata->fullmessageformat = $notification->fullmessageformat ?? FORMAT_MOODLE;
          $tabledata->fullmessagehtml = $notification->fullmessagehtml;
          $tabledata->smallmessage = $notification->smallmessage;
          $tabledata->component = $notification->component;
          $tabledata->eventtype = $notification->eventtype;
          $tabledata->contexturl = $notification->contexturl;
          $tabledata->contexturlname = $notification->contexturlname;
          $tabledata->timeread = $notification->timeread ?? null;
          $tabledata->timecreated = $notification->timecreated;
  
          $newid = $DB->insert_record('notifications', $tabledata);
  
          // Check if there is a record to move to the new 'message_popup_notifications' table.
          if ($mp = $DB->get_record('message_popup', ['messageid' => $notification->id, 'isread' => (int) $isread])) {
              $mpn = new \stdClass();
              $mpn->notificationid = $newid;
              $DB->insert_record('message_popup_notifications', $mpn);
  
              $DB->delete_records('message_popup', ['id' => $mp->id]);
          }
      }
code: private function migrate_notification($notification, $isread) {
          global $DB;
  
          $tabledata = new \stdClass();
          $tabledata->useridfrom = $notification->useridfrom;
          $tabledata->useridto = $notification->useridto;
          $tabledata->subject = $notification->subject;
          $tabledata->fullmessage = $notification->fullmessage;
          $tabledata->fullmessageformat = $notification->fullmessageformat ?? FORMAT_MOODLE;
          $tabledata->fullmessagehtml = $notification->fullmessagehtml;
          $tabledata->smallmessage = $notification->smallmessage;
          $tabledata->component = $notification->component;
          $tabledata->eventtype = $notification->eventtype;
          $tabledata->contexturl = $notification->contexturl;
          $tabledata->contexturlname = $notification->contexturlname;
          $tabledata->timeread = $notification->timeread ?? null;
          $tabledata->timecreated = $notification->timecreated;
  
          $newid = $DB->insert_record('notifications', $tabledata);
  
          // Check if there is a record to move to the new 'message_popup_notifications' table.
          if ($mp = $DB->get_record('message_popup', ['messageid' => $notification->id, 'isread' => (int) $isread])) {
              $mpn = new \stdClass();
              $mpn->notificationid = $newid;
              $DB->insert_record('message_popup_notifications', $mpn);
  
              $DB->delete_records('message_popup', ['id' => $mp->id]);
          }
      }
code_tokens: private function migrate_notification ( $ notification , $ isread ) { global $ DB ; $ tabledata = new \ stdClass ( ) ; $ tabledata -> useridfrom = $ notification -> useridfrom ; $ tabledata -> useridto = $ notification -> useridto ; $ tabledata -> subject = $ notification -> subject ; $ tabledata -> fullmessage = $ notification -> fullmessage ; $ tabledata -> fullmessageformat = $ notification -> fullmessageformat ?? FORMAT_MOODLE ; $ tabledata -> fullmessagehtml = $ notification -> fullmessagehtml ; $ tabledata -> smallmessage = $ notification -> smallmessage ; $ tabledata -> component = $ notification -> component ; $ tabledata -> eventtype = $ notification -> eventtype ; $ tabledata -> contexturl = $ notification -> contexturl ; $ tabledata -> contexturlname = $ notification -> contexturlname ; $ tabledata -> timeread = $ notification -> timeread ?? null ; $ tabledata -> timecreated = $ notification -> timecreated ; $ newid = $ DB -> insert_record ( 'notifications' , $ tabledata ) ; // Check if there is a record to move to the new 'message_popup_notifications' table. if ( $ mp = $ DB -> get_record ( 'message_popup' , [ 'messageid' => $ notification -> id , 'isread' => ( int ) $ isread ] ) ) { $ mpn = new \ stdClass ( ) ; $ mpn -> notificationid = $ newid ; $ DB -> insert_record ( 'message_popup_notifications' , $ mpn ) ; $ DB -> delete_records ( 'message_popup' , [ 'id' => $ mp -> id ] ) ; } }
docstring: Helper function to deal with migrating an individual notification.
  
  @param \stdClass $notification
  @param bool $isread Was the notification read?
  @throws \dml_exception
docstring_tokens: Helper function to deal with migrating an individual notification .