mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
[ticket/11403] phpbb_notification_manager: Use SQL multi insert in batches.
PHPBB3-11403
This commit is contained in:
@@ -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
|
||||
$this->db->sql_multi_insert($this->notifications_table, $new_rows);
|
||||
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);
|
||||
|
Reference in New Issue
Block a user