mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-24339 workaround for broken parents in block instances
This commit is contained in:
parent
5a2543286f
commit
b7b88c090d
@ -5701,12 +5701,14 @@ function build_context_path($force=false) {
|
||||
$DB->execute($sql);
|
||||
|
||||
// Blocks
|
||||
// pctx.path IS NOT NULL prevents fatal problems with broken block instances that point to invalid context parent
|
||||
$sql = "INSERT INTO {context_temp} (id, path, depth)
|
||||
SELECT ctx.id, ".$DB->sql_concat('pctx.path', "'/'", 'ctx.id').", pctx.depth+1
|
||||
FROM {context} ctx
|
||||
JOIN {block_instances} bi ON ctx.instanceid = bi.id
|
||||
JOIN {context} pctx ON bi.parentcontextid = pctx.id
|
||||
WHERE ctx.contextlevel=".CONTEXT_BLOCK."
|
||||
AND pctx.path IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 'x'
|
||||
FROM {context_temp} temp
|
||||
WHERE temp.id = ctx.id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user