Details
-
Type:
Improvement
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 3.9.2
-
Fix Version/s: None
-
Component/s: Database SQL/XMLDB, Messages
-
Labels:None
-
Affected Branches:MOODLE_39_STABLE
Description
Methods \message_output_popup::cleanup_all_notifications and \message_output_popup::cleanup_read_notifications do not have fully optimized delete queries.
This
public function cleanup_all_notifications(int $notificationdeletetime): void { |
global $DB;
|
|
$DB->delete_records_select('message_popup_notifications', |
'notificationid IN (SELECT id FROM {notifications} WHERE timecreated < ?)', [$notificationdeletetime]); |
}
|
Should become this:
public function cleanup_all_notifications(int $notificationdeletetime): void { |
global $DB;
|
|
$DB->delete_records_select(
|
'message_popup_notifications', |
'EXISTS (
|
SELECT id
|
FROM {notifications}
|
WHERE timecreated < ? AND id = {message_popup_notifications}.notificationid
|
)',
|
[$notificationdeletetime]
|
);
|
}
|
|