mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'master_MDL-67440' of https://github.com/danmarsden/moodle
This commit is contained in:
commit
6c579b60f2
1 changed files with 19 additions and 3 deletions
|
@ -624,9 +624,25 @@ class manager {
|
||||||
LEFT JOIN {context} ctx ON ap.contextid = ctx.id
|
LEFT JOIN {context} ctx ON ap.contextid = ctx.id
|
||||||
WHERE ctx.id IS NULL)");
|
WHERE ctx.id IS NULL)");
|
||||||
|
|
||||||
$contextsql = "SELECT id FROM {context} ctx";
|
// Cleanup analaytics predictions/calcs with MySQL friendly sub-select.
|
||||||
$DB->delete_records_select('analytics_predictions', "contextid NOT IN ($contextsql)");
|
$DB->execute("DELETE FROM {analytics_predictions} WHERE id IN (
|
||||||
$DB->delete_records_select('analytics_indicator_calc', "contextid NOT IN ($contextsql)");
|
SELECT oldpredictions.id
|
||||||
|
FROM (
|
||||||
|
SELECT p.id
|
||||||
|
FROM {analytics_predictions} p
|
||||||
|
LEFT JOIN {context} ctx ON p.contextid = ctx.id
|
||||||
|
WHERE ctx.id IS NULL
|
||||||
|
) oldpredictions
|
||||||
|
)");
|
||||||
|
|
||||||
|
$DB->execute("DELETE FROM {analytics_indicator_calc} WHERE id IN (
|
||||||
|
SELECT oldcalcs.id FROM (
|
||||||
|
SELECT c.id
|
||||||
|
FROM {analytics_indicator_calc} c
|
||||||
|
LEFT JOIN {context} ctx ON c.contextid = ctx.id
|
||||||
|
WHERE ctx.id IS NULL
|
||||||
|
) oldcalcs
|
||||||
|
)");
|
||||||
|
|
||||||
// Clean up stuff that depends on analysable ids that do not exist anymore.
|
// Clean up stuff that depends on analysable ids that do not exist anymore.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue