original_string: protected function domain_swap($table, $column, $domain, $search) {
          global $DB;
  
          $renames = json_decode(get_config('tool_httpsreplace', 'renames'), true);
  
          if (isset($renames[$domain])) {
              $replace = preg_replace('|http://'.preg_quote($domain).'|i', 'https://' . $renames[$domain], $search);
          } else {
              $replace = preg_replace('|http://|i', 'https://', $search);
          }
          $DB->set_debug(true);
          $DB->replace_all_text($table, $column, $search, $replace);
          $DB->set_debug(false);
      }
code: protected function domain_swap($table, $column, $domain, $search) {
          global $DB;
  
          $renames = json_decode(get_config('tool_httpsreplace', 'renames'), true);
  
          if (isset($renames[$domain])) {
              $replace = preg_replace('|http://'.preg_quote($domain).'|i', 'https://' . $renames[$domain], $search);
          } else {
              $replace = preg_replace('|http://|i', 'https://', $search);
          }
          $DB->set_debug(true);
          $DB->replace_all_text($table, $column, $search, $replace);
          $DB->set_debug(false);
      }
code_tokens: protected function domain_swap ( $ table , $ column , $ domain , $ search ) { global $ DB ; $ renames = json_decode ( get_config ( 'tool_httpsreplace' , 'renames' ) , true ) ; if ( isset ( $ renames [ $ domain ] ) ) { $ replace = preg_replace ( '|http://' . preg_quote ( $ domain ) . '|i' , 'https://' . $ renames [ $ domain ] , $ search ) ; } else { $ replace = preg_replace ( '|http://|i' , 'https://' , $ search ) ; } $ DB -> set_debug ( true ) ; $ DB -> replace_all_text ( $ table , $ column , $ search , $ replace ) ; $ DB -> set_debug ( false ) ; }
docstring: Replace http domains with https equivalent, with two types of exceptions
  for less straightforward swaps.
  
  @param string $table
  @param database_column_info $column
  @param string $domain
  @param string $search search string that has prefix, protocol, domain name and one extra character,
  example1: src="http://host.com/
  example2: DATA="HTTP://MYDOMAIN.EDU"
  example3: src="HTTP://hello.world?
  @return void
docstring_tokens: Replace http domains with https equivalent with two types of exceptions for less straightforward swaps .