original_string: public static function delete_favourites_for_userlist(\core_privacy\local\request\approved_userlist $userlist,
                                                            string $itemtype, int $itemid = 0) {
          global $DB;
  
          $userids = $userlist->get_userids();
  
          if (empty($userids)) {
              return;
          }
  
          $context = $userlist->get_context();
          list($usersql, $userparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
  
          $params = [
              'component' => $userlist->get_component(),
              'itemtype' => $itemtype,
              'contextid' => $context->id
          ];
  
          $params += $userparams;
          $select = "component = :component AND itemtype = :itemtype AND contextid = :contextid AND userid $usersql";
  
          if (!empty($itemid)) {
              $select .= " AND itemid = :itemid";
              $params['itemid'] = $itemid;
          }
  
          $DB->delete_records_select('favourite', $select, $params);
      }
code: public static function delete_favourites_for_userlist(\core_privacy\local\request\approved_userlist $userlist,
                                                            string $itemtype, int $itemid = 0) {
          global $DB;
  
          $userids = $userlist->get_userids();
  
          if (empty($userids)) {
              return;
          }
  
          $context = $userlist->get_context();
          list($usersql, $userparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
  
          $params = [
              'component' => $userlist->get_component(),
              'itemtype' => $itemtype,
              'contextid' => $context->id
          ];
  
          $params += $userparams;
          $select = "component = :component AND itemtype = :itemtype AND contextid = :contextid AND userid $usersql";
  
          if (!empty($itemid)) {
              $select .= " AND itemid = :itemid";
              $params['itemid'] = $itemid;
          }
  
          $DB->delete_records_select('favourite', $select, $params);
      }
code_tokens: public static function delete_favourites_for_userlist ( \ core_privacy \ local \ request \ approved_userlist $ userlist , string $ itemtype , int $ itemid = 0 ) { global $ DB ; $ userids = $ userlist -> get_userids ( ) ; if ( empty ( $ userids ) ) { return ; } $ context = $ userlist -> get_context ( ) ; list ( $ usersql , $ userparams ) = $ DB -> get_in_or_equal ( $ userids , SQL_PARAMS_NAMED ) ; $ params = [ 'component' => $ userlist -> get_component ( ) , 'itemtype' => $ itemtype , 'contextid' => $ context -> id ] ; $ params += $ userparams ; $ select = "component = :component AND itemtype = :itemtype AND contextid = :contextid AND userid $usersql" ; if ( ! empty ( $ itemid ) ) { $ select .= " AND itemid = :itemid" ; $ params [ 'itemid' ] = $ itemid ; } $ DB -> delete_records_select ( 'favourite' , $ select , $ params ) ; }
docstring: Delete all favourites for the specified users in the specified context, component area and item type.
  
  @param \core_privacy\local\request\approved_userlist $userlist The approved contexts and user information
  to delete information for.
  @param string $itemtype The favourite's itemtype.
  @param int $itemid Optional itemid associated with component.
  @throws \dml_exception if any errors are encountered during deletion.
docstring_tokens: Delete all favourites for the specified users in the specified context component area and item type .