Commit 4bc9112b authored by Andrew Nicols's avatar Andrew Nicols
Browse files

Merge branch 'wip-MDL-50851-backupfix' of git://github.com/marinaglancy/moodle

parents 1002024c 25430f75
...@@ -631,7 +631,7 @@ class blog_listing { ...@@ -631,7 +631,7 @@ class blog_listing {
$allnamefields = \user_picture::fields('u', null, 'useridalias'); $allnamefields = \user_picture::fields('u', null, 'useridalias');
// The query used to locate blog entries is complicated. It will be built from the following components: // The query used to locate blog entries is complicated. It will be built from the following components:
$requiredfields = "p.*, $allnamefields, u.email"; // The SELECT clause. $requiredfields = "p.*, $allnamefields"; // The SELECT clause.
$tables = array('p' => 'post', 'u' => 'user'); // Components of the FROM clause (table_id => table_name). $tables = array('p' => 'post', 'u' => 'user'); // Components of the FROM clause (table_id => table_name).
// Components of the WHERE clause (conjunction). // Components of the WHERE clause (conjunction).
$conditions = array('u.deleted = 0', 'p.userid = u.id', '(p.module = \'blog\' OR p.module = \'blog_external\')'); $conditions = array('u.deleted = 0', 'p.userid = u.id', '(p.module = \'blog\' OR p.module = \'blog_external\')');
......
...@@ -401,13 +401,15 @@ class core_tag_area { ...@@ -401,13 +401,15 @@ class core_tag_area {
$result->close(); $result->close();
// Find all tags that are used for this itemtype/component and are not present in the target tag collection. // Find all tags that are used for this itemtype/component and are not present in the target tag collection.
$sql = "SELECT DISTINCT t.id, t.name, t.rawname, t.description, t.descriptionformat, // This query is a little complicated because Oracle does not allow to run SELECT DISTINCT on CLOB fields.
t.userid, t.tagtype, t.flag $sql = "SELECT id, name, rawname, description, descriptionformat, userid, tagtype, flag
FROM {tag} WHERE id IN
(SELECT t.id
FROM {tag_instance} ti FROM {tag_instance} ti
JOIN {tag} t ON t.id = ti.tagid AND t.tagcollid <> :tagcollid1 JOIN {tag} t ON t.id = ti.tagid AND t.tagcollid <> :tagcollid1
LEFT JOIN {tag} tt ON tt.name = t.name AND tt.tagcollid = :tagcollid2 LEFT JOIN {tag} tt ON tt.name = t.name AND tt.tagcollid = :tagcollid2
WHERE ti.itemtype = :itemtype2 AND ti.component = :component2 WHERE ti.itemtype = :itemtype2 AND ti.component = :component2
AND tt.id IS NULL"; AND tt.id IS NULL)";
$todelete = array(); $todelete = array();
$result = $DB->get_records_sql($sql, $params); $result = $DB->get_records_sql($sql, $params);
foreach ($result as $tag) { foreach ($result as $tag) {
......
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