mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-63968 message: Correct use of get_in_or_equal
This commit is contained in:
parent
208950cff0
commit
e926b4d046
2 changed files with 56 additions and 7 deletions
|
@ -516,12 +516,10 @@ class api {
|
|||
// If we need to return ONLY favourites, or NO favourites, generate the SQL snippet.
|
||||
$favouritesql = "";
|
||||
$favouriteparams = [];
|
||||
if (is_bool($favourites)) {
|
||||
if (!empty($favouriteconversationids)) {
|
||||
list ($insql, $inparams) = $DB->get_in_or_equal($favouriteconversationids, SQL_PARAMS_NAMED, 'favouriteids');
|
||||
$favouritesql = $favourites ? " AND mc.id {$insql} " : " AND mc.id NOT {$insql} ";
|
||||
$favouriteparams = $inparams;
|
||||
}
|
||||
if (null !== $favourites && !empty($favouriteconversationids)) {
|
||||
list ($insql, $favouriteparams) =
|
||||
$DB->get_in_or_equal($favouriteconversationids, SQL_PARAMS_NAMED, 'favouriteids', $favourites);
|
||||
$favouritesql = " AND mc.id {$insql} ";
|
||||
}
|
||||
|
||||
// If we need to restrict type, generate the SQL snippet.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue