original_string: protected static function delete_batch_records($tablename, $field, $values) {
          global $DB;
  
          // Batch deletion with an upper limit of 2000 records to minimise the number of deletion queries.
          $batchrecords = array_chunk($values, 2000);
  
          foreach ($batchrecords as $batchrecord) {
              $DB->delete_records_list($tablename, $field, $batchrecord);
          }
      }
code: protected static function delete_batch_records($tablename, $field, $values) {
          global $DB;
  
          // Batch deletion with an upper limit of 2000 records to minimise the number of deletion queries.
          $batchrecords = array_chunk($values, 2000);
  
          foreach ($batchrecords as $batchrecord) {
              $DB->delete_records_list($tablename, $field, $batchrecord);
          }
      }
code_tokens: protected static function delete_batch_records ( $ tablename , $ field , $ values ) { global $ DB ; // Batch deletion with an upper limit of 2000 records to minimise the number of deletion queries. $ batchrecords = array_chunk ( $ values , 2000 ) ; foreach ( $ batchrecords as $ batchrecord ) { $ DB -> delete_records_list ( $ tablename , $ field , $ batchrecord ) ; } }
docstring: Helper function to delete records in batches in order to minimise amount of deletion queries.
  
  @param string    $tablename  The table name to delete from.
  @param string    $field      The table column field name to delete records by.
  @param array     $values     The table column field values to delete records by.
  @throws \dml_exception
docstring_tokens: Helper function to delete records in batches in order to minimise amount of deletion queries .