MDL-46269 tool_httpsreplace: Make param search case insensitive

This commit is contained in:
John Okely
2017-09-11 10:30:01 +08:00
committed by Marina Glancy
parent 6163651e76
commit 4b86dd7ba6
2 changed files with 7 additions and 2 deletions
@@ -153,7 +153,7 @@ class url_finder {
if (in_array($column->type, $texttypes)) {
$columnname = $column->name;
$select = "$columnname $regexp ?";
$select = "LOWER($columnname) $regexp ?";
$rs = $DB->get_recordset_select($table, $select, [$httpurls]);
$found = array();
@@ -161,7 +161,7 @@ class url_finder {
// Regex to match src=http://etc. and data=http://etc.urls.
// Standard warning on expecting regex to perfectly parse HTML
// read http://stackoverflow.com/a/1732454 for more info.
$regex = '#(src|data)\ *=\ *[\'\"]http://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))[\'\"]#';
$regex = '#(src|data)\ *=\ *[\'\"]http://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))[\'\"]#i';
preg_match_all($regex, $record->$columnname, $match);
foreach ($match[0] as $url) {
if (strpos($url, $CFG->wwwroot) !== false) {