MDL-46269 tool_httpsreplace: Support DBs with no regex (oracle & mssql)

This commit is contained in:
John Okely
2017-09-04 14:08:01 +08:00
committed by Marina Glancy
parent c74748c6bd
commit 6163651e76
3 changed files with 20 additions and 2 deletions
+10 -2
View File
@@ -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)) {