mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-24080 converting remaining NOT LIKEs
This commit is contained in:
parent
2225fb4809
commit
4758639429
@ -184,7 +184,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim
|
||||
if ($modaction) {
|
||||
$firstletter = substr($modaction, 0, 1);
|
||||
if ($firstletter == '-') {
|
||||
$where .= " AND l.action NOT LIKE :modaction"; //TODO: MDL-24080
|
||||
$where .= " AND ".$DB->sql_like('l.action', ':modaction', false, true, true);
|
||||
$params['modaction'] = '%'.substr($modaction, 1).'%';
|
||||
} else {
|
||||
$where .= " AND ".$DB->sql_like('l.action', ':modaction', false);
|
||||
@ -266,7 +266,7 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit
|
||||
if ($modaction) {
|
||||
$firstletter = substr($modaction, 0, 1);
|
||||
if ($firstletter == '-') {
|
||||
$joins[] = "l.action NOT LIKE :modaction"; //TODO: MDL-24080
|
||||
$joins[] = $DB->sql_like('l.action', ':modaction', false, true, true);
|
||||
$params['modaction'] = '%'.substr($modaction, 1).'%';
|
||||
} else {
|
||||
$joins[] = $DB->sql_like('l.action', ':modaction', false);
|
||||
|
@ -752,11 +752,7 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
|
||||
$params['ss'.$i] = "(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)";
|
||||
|
||||
} else {
|
||||
if ($NOT) {
|
||||
$searchcond[] = "$concat NOT LIKE :ss$i"; //TODO: MDL-24080
|
||||
} else {
|
||||
$searchcond[] = $DB->sql_like($concat,":ss$i", false);
|
||||
}
|
||||
$searchcond[] = $DB->sql_like($concat,":ss$i", false, true, $NOT);
|
||||
$params['ss'.$i] = "%$searchterm%";
|
||||
}
|
||||
}
|
||||
|
@ -1171,7 +1171,7 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none'
|
||||
foreach ($searchterms as $searchterm) {
|
||||
$i++;
|
||||
|
||||
$NOT = ''; /// Initially we aren't going to perform NOT LIKE searches, only MSSQL and Oracle
|
||||
$NOT = false; /// Initially we aren't going to perform NOT LIKE searches, only MSSQL and Oracle
|
||||
|
||||
if ($dropshortwords && strlen($searchterm) < 2) {
|
||||
continue;
|
||||
@ -1180,7 +1180,7 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none'
|
||||
/// simpler LIKE search
|
||||
if (!$DB->sql_regex_supported()) {
|
||||
if (substr($searchterm, 0, 1) == '-') {
|
||||
$NOT = ' NOT ';
|
||||
$NOT = true;
|
||||
}
|
||||
$searchterm = trim($searchterm, '+-');
|
||||
}
|
||||
@ -1198,7 +1198,7 @@ function message_search($searchterms, $fromme=true, $tome=true, $courseid='none'
|
||||
$params['ss'.$i] = "(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)";
|
||||
|
||||
} else {
|
||||
$searchcond[] = "m.fullmessage NOT LIKE :ss$i"; //TODO: MDL-24080
|
||||
$searchcond[] = $DB->sql_like("m.fullmessage", ":ss$i", false, true, $NOT);
|
||||
$params['ss'.$i] = "%$searchterm%";
|
||||
}
|
||||
}
|
||||
|
@ -1238,11 +1238,7 @@ function glossary_search($course, $searchterms, $extended = 0, $glossary = NULL)
|
||||
$params['ss'.$i] = "(^|[^a-zA-Z0-9])$searchterm([^a-zA-Z0-9]|$)";
|
||||
|
||||
} else {
|
||||
if ($NOT) {
|
||||
$searchcond[] = "$concat NOT LIKE :ss$i"; //TODO: MDL-24080
|
||||
} else {
|
||||
$searchcond[] = $DB->sql_like($concat, ":ss$i", false);
|
||||
}
|
||||
$searchcond[] = $DB->sql_like($concat, ":ss$i", false, true, $NOT);
|
||||
$params['ss'.$i] = "%$searchterm%";
|
||||
}
|
||||
}
|
||||
|
@ -192,11 +192,7 @@
|
||||
if ($textlib->strlen($searchterm) < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($NOT) {
|
||||
$searchcond[] = "$concat NOT LIKE :ss$i"; //TODO: MDL-24080
|
||||
} else {
|
||||
$searchcond[] = $DB->sql_like($concat, ":ss$i", false);
|
||||
}
|
||||
$searchcond[] = $DB->sql_like($concat, ":ss$i", false, true, $NOT);
|
||||
$params['ss'.$i] = "%$searchterm%";
|
||||
}
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class user_filter_profilefield extends user_filter_type {
|
||||
$params[$name] = "%$value%";
|
||||
break;
|
||||
case 1: // does not contain
|
||||
$where = "data NOT LIKE :$name"; //TODO: MDL-24080
|
||||
$where = $DB->sql_like('data', ":$name", false, false, true);
|
||||
$params[$name] = "%$value%";
|
||||
break;
|
||||
case 2: // equal to
|
||||
|
@ -94,7 +94,7 @@ class user_filter_text extends user_filter_type {
|
||||
$params[$name] = "%$value%";
|
||||
break;
|
||||
case 1: // does not contain
|
||||
$res = "$field NOT LIKE :$name"; //TODO: MDL-24080
|
||||
$res = $DB->sql_like($field, ":$name", false, false, true);
|
||||
$params[$name] = "%$value%";
|
||||
break;
|
||||
case 2: // equal to
|
||||
|
Loading…
x
Reference in New Issue
Block a user