mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11403] phpbb_notification_manager: Use SQL multi insert in batches.
PHPBB3-11403
This commit is contained in:
parent
1b71779432
commit
6910d44154
1 changed files with 11 additions and 2 deletions
|
@ -430,6 +430,13 @@ class phpbb_notification_manager
|
|||
// Store the creation array in our new rows that will be inserted later
|
||||
$new_rows[] = $notification->create_insert_array($data, $pre_create_data);
|
||||
|
||||
// Flush to DB if $new_rows is big enough.
|
||||
if (sizeof($new_rows) > 500)
|
||||
{
|
||||
$this->db->sql_multi_insert($this->notifications_table, $new_rows);
|
||||
$new_rows = array();
|
||||
}
|
||||
|
||||
// Users are needed to send notifications
|
||||
$user_ids = array_merge($user_ids, $notification->users_to_query());
|
||||
|
||||
|
@ -448,8 +455,10 @@ class phpbb_notification_manager
|
|||
}
|
||||
}
|
||||
|
||||
// insert into the db
|
||||
if (!empty($new_rows))
|
||||
{
|
||||
$this->db->sql_multi_insert($this->notifications_table, $new_rows);
|
||||
}
|
||||
|
||||
// We need to load all of the users to send notifications
|
||||
$this->user_loader->load_users($user_ids);
|
||||
|
|
Loading…
Add table
Reference in a new issue