diff --git a/admin/tool/httpsreplace/classes/url_finder.php b/admin/tool/httpsreplace/classes/url_finder.php index 619e46898bf..734c4e1a1ea 100644 --- a/admin/tool/httpsreplace/classes/url_finder.php +++ b/admin/tool/httpsreplace/classes/url_finder.php @@ -92,7 +92,14 @@ class url_finder { require_once($CFG->libdir.'/filelib.php'); - $httpurls = "(src|data)\ *=\ *[\\\"\']http://"; + if ($DB->sql_regex_supported()) { + $regexp = $DB->sql_regex(); + $httpurls = "(src|data)\ *=\ *[\\\"\']http://"; + } else { + // Simpler query for DBs without regex support. + $regexp = "like"; + $httpurls = "%=%http://%"; + } // TODO: block_instances have HTML content as base64, need to decode then // search, currently just skipped. See MDL-60024. @@ -127,6 +134,8 @@ class url_finder { 'mediumtext', 'longtext', 'varchar', + 'nvarchar', + 'CLOB', ); $numberoftables = count($tables); @@ -140,7 +149,6 @@ class url_finder { continue; } if ($columns = $DB->get_columns($table)) { - $regexp = $DB->sql_regex(); foreach ($columns as $column) { if (in_array($column->type, $texttypes)) { diff --git a/admin/tool/httpsreplace/cli/url_finder.php b/admin/tool/httpsreplace/cli/url_finder.php index 82bd3744db7..58831b1755c 100644 --- a/admin/tool/httpsreplace/cli/url_finder.php +++ b/admin/tool/httpsreplace/cli/url_finder.php @@ -41,6 +41,11 @@ Example: exit(0); } +if (!$DB->replace_all_text_supported()) { + echo $OUTPUT->notification(get_string('notimplemented', 'tool_httpsreplace')); + exit(1); +} + if (!is_https()) { echo $OUTPUT->notification(get_string('httpwarning', 'tool_httpsreplace'), 'warning'); } diff --git a/admin/tool/httpsreplace/cli/url_replace.php b/admin/tool/httpsreplace/cli/url_replace.php index 33e4affbb19..597eb6659c6 100644 --- a/admin/tool/httpsreplace/cli/url_replace.php +++ b/admin/tool/httpsreplace/cli/url_replace.php @@ -41,6 +41,11 @@ Example: exit(0); } +if (!$DB->replace_all_text_supported()) { + echo $OUTPUT->notification(get_string('notimplemented', 'tool_httpsreplace')); + exit(1); +} + if (!is_https()) { echo $OUTPUT->notification(get_string('httpwarning', 'tool_httpsreplace'), 'warning'); }