diff options
author | Andreas Fischer <bantu@phpbb.com> | 2013-03-17 22:15:10 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2013-03-29 16:37:04 +0100 |
commit | 6910d441546f5213eab11b2329b49e5a6626ad67 (patch) | |
tree | 275bc5b1394e5019bc50c2664b5c5c23eb695769 /phpBB/includes/notification | |
parent | 1b71779432d6325d6f7da0671a07eaf7d400bfbc (diff) | |
download | forums-6910d441546f5213eab11b2329b49e5a6626ad67.tar forums-6910d441546f5213eab11b2329b49e5a6626ad67.tar.gz forums-6910d441546f5213eab11b2329b49e5a6626ad67.tar.bz2 forums-6910d441546f5213eab11b2329b49e5a6626ad67.tar.xz forums-6910d441546f5213eab11b2329b49e5a6626ad67.zip |
[ticket/11403] phpbb_notification_manager: Use SQL multi insert in batches.
PHPBB3-11403
Diffstat (limited to 'phpBB/includes/notification')
-rw-r--r-- | phpBB/includes/notification/manager.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index 4e26234390..ee81cc0f7c 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -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); |