Commit 83acb499 authored by Marina Glancy's avatar Marina Glancy
Browse files

MDL-50851 core_tag: make query cross-db compatible

parent 59a968dc
...@@ -796,10 +796,11 @@ class core_tag_tag { ...@@ -796,10 +796,11 @@ class core_tag_tag {
'contextid' => $record->taginstancecontextid, 'tiuserid' => $tiuserid); 'contextid' => $record->taginstancecontextid, 'tiuserid' => $tiuserid);
$tag = new static($record); $tag = new static($record);
$tag->delete_instance_as_record($taginstance, false); $tag->delete_instance_as_record($taginstance, false);
$sql = "UPDATE {tag_instance} ti SET ordering = ordering - 1 $componentsql = $component ? " AND component = :component " : "";
WHERE ti.itemtype = :itemtype $sql = "UPDATE {tag_instance} SET ordering = ordering - 1
AND ti.itemid = :itemid $componentsql $usersql WHERE itemtype = :itemtype
AND ti.ordering > :ordering"; AND itemid = :itemid $componentsql $usersql
AND ordering > :ordering";
$params['ordering'] = $record->ordering; $params['ordering'] = $record->ordering;
$DB->execute($sql, $params); $DB->execute($sql, $params);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment