original_string: public static function preload_contexts_by_id(array $contextids) {
          global $DB;
  
          // Determine which contexts are not already cached.
          $tofetch = [];
          foreach ($contextids as $contextid) {
              if (!self::cache_get_by_id($contextid)) {
                  $tofetch[] = $contextid;
              }
          }
  
          if (count($tofetch) > 1) {
              // There are at least two to fetch.
              // There is no point only fetching a single context as this would be no more efficient than calling the existing code.
              list($insql, $inparams) = $DB->get_in_or_equal($tofetch, SQL_PARAMS_NAMED);
              $ctxs = $DB->get_records_select('context', "id {$insql}", $inparams, '',
                      \context_helper::get_preload_record_columns_sql('{context}'));
              foreach ($ctxs as $ctx) {
                  self::preload_from_record($ctx);
              }
          }
      }
code: public static function preload_contexts_by_id(array $contextids) {
          global $DB;
  
          // Determine which contexts are not already cached.
          $tofetch = [];
          foreach ($contextids as $contextid) {
              if (!self::cache_get_by_id($contextid)) {
                  $tofetch[] = $contextid;
              }
          }
  
          if (count($tofetch) > 1) {
              // There are at least two to fetch.
              // There is no point only fetching a single context as this would be no more efficient than calling the existing code.
              list($insql, $inparams) = $DB->get_in_or_equal($tofetch, SQL_PARAMS_NAMED);
              $ctxs = $DB->get_records_select('context', "id {$insql}", $inparams, '',
                      \context_helper::get_preload_record_columns_sql('{context}'));
              foreach ($ctxs as $ctx) {
                  self::preload_from_record($ctx);
              }
          }
      }
code_tokens: public static function preload_contexts_by_id ( array $ contextids ) { global $ DB ; // Determine which contexts are not already cached. $ tofetch = [ ] ; foreach ( $ contextids as $ contextid ) { if ( ! self :: cache_get_by_id ( $ contextid ) ) { $ tofetch [ ] = $ contextid ; } } if ( count ( $ tofetch ) > 1 ) { // There are at least two to fetch. // There is no point only fetching a single context as this would be no more efficient than calling the existing code. list ( $ insql , $ inparams ) = $ DB -> get_in_or_equal ( $ tofetch , SQL_PARAMS_NAMED ) ; $ ctxs = $ DB -> get_records_select ( 'context' , "id {$insql}" , $ inparams , '' , \ context_helper :: get_preload_record_columns_sql ( '{context}' ) ) ; foreach ( $ ctxs as $ ctx ) { self :: preload_from_record ( $ ctx ) ; } } }
docstring: Preload a set of contexts using their contextid.
  
  @param   array $contextids
docstring_tokens: Preload a set of contexts using their contextid .