aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/migration/data
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-08-04 23:44:41 +0200
committerJoas Schilling <nickvergessen@gmx.de>2013-09-26 01:14:29 +0200
commit29c84be40a8c60fe98ba6bd2e817fcef14b491ba (patch)
treeb34563134b524fc94caf4343e7cc8267fa49a717 /phpBB/phpbb/db/migration/data
parenta7af736b9776d724fd2ca77b84b6623eba3edaef (diff)
downloadforums-29c84be40a8c60fe98ba6bd2e817fcef14b491ba.tar
forums-29c84be40a8c60fe98ba6bd2e817fcef14b491ba.tar.gz
forums-29c84be40a8c60fe98ba6bd2e817fcef14b491ba.tar.bz2
forums-29c84be40a8c60fe98ba6bd2e817fcef14b491ba.tar.xz
forums-29c84be40a8c60fe98ba6bd2e817fcef14b491ba.zip
[ticket/11691] Stagger user notification reconversion even more
PHPBB3-11691
Diffstat (limited to 'phpBB/phpbb/db/migration/data')
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php31
1 files changed, 24 insertions, 7 deletions
diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
index bd7614e1c2..16509d7833 100644
--- a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
+++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
@@ -23,12 +23,19 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
);
}
- public function convert_notifications()
+ public function convert_notifications($start)
{
$insert_table = $this->table_prefix . 'user_notifications';
$insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $insert_table);
- $this->perform_conversion($insert_buffer, $insert_table);
+ $start = (int) $start;
+ if ($start == 0)
+ {
+ $sql = 'DELETE FROM ' . $insert_table;
+ $this->db->sql_query($sql);
+ }
+
+ return $this->perform_conversion($insert_buffer, $insert_table, $start);
}
/**
@@ -37,17 +44,19 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
* @param \phpbb\db\sql_insert_buffer $insert_buffer
* @param string $insert_table
*/
- public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $insert_table)
+ public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $insert_table, $start)
{
- $sql = 'DELETE FROM ' . $insert_table;
- $this->db->sql_query($sql);
+ $limit = 250;
+ $converted_users = 0;
$sql = 'SELECT user_id, user_notify_type, user_notify_pm
- FROM ' . USERS_TABLE;
- $result = $this->db->sql_query($sql);
+ FROM ' . USERS_TABLE . '
+ ORDER BY user_id';
+ $result = $this->db->sql_query_limit($sql, $limit, $start);
while ($row = $this->db->sql_fetchrow($result))
{
+ $converted_users++;
$notification_methods = array();
// In-board notification
@@ -91,6 +100,14 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
$this->db->sql_freeresult($result);
$insert_buffer->flush();
+
+ if ($converted_users < $limit)
+ {
+ // No more users left, we are done...
+ return;
+ }
+
+ return $start + $limit;
}
/**