diff options
author | Nathan <nathaniel.guse@gmail.com> | 2013-10-02 14:23:01 -0500 |
---|---|---|
committer | Nathan <nathaniel.guse@gmail.com> | 2013-10-02 14:23:01 -0500 |
commit | ee89ede59faab3809cc61b7773a99f3e24376fb8 (patch) | |
tree | fa6c42e23ec1825a36e944db2dcb7e59fa0f28a8 /phpBB/phpbb/db/migration/data/v310/timezone.php | |
parent | 49ce2c13b26e358b4ccef440094a8fa4b6b9afd7 (diff) | |
download | forums-ee89ede59faab3809cc61b7773a99f3e24376fb8.tar forums-ee89ede59faab3809cc61b7773a99f3e24376fb8.tar.gz forums-ee89ede59faab3809cc61b7773a99f3e24376fb8.tar.bz2 forums-ee89ede59faab3809cc61b7773a99f3e24376fb8.tar.xz forums-ee89ede59faab3809cc61b7773a99f3e24376fb8.zip |
[ticket/11881] Timezone migration can take a long time
PHPBB3-11881
Diffstat (limited to 'phpBB/phpbb/db/migration/data/v310/timezone.php')
-rw-r--r-- | phpBB/phpbb/db/migration/data/v310/timezone.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/phpBB/phpbb/db/migration/data/v310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php index dd0c6a2093..8443f7b492 100644 --- a/phpBB/phpbb/db/migration/data/v310/timezone.php +++ b/phpBB/phpbb/db/migration/data/v310/timezone.php @@ -39,16 +39,22 @@ class timezone extends \phpbb\db\migration\migration ); } - public function update_timezones() + public function update_timezones($start) { + $start = (int) $start; + $limit = 1; + $converted_timezones = 0; + // Update user timezones $sql = 'SELECT user_dst, user_timezone FROM ' . $this->table_prefix . 'users GROUP BY user_timezone, user_dst'; - $result = $this->db->sql_query($sql); + $result = $this->db->sql_query_limit($sql, $limit, $start); while ($row = $this->db->sql_fetchrow($result)) { + $converted_timezones++; + $sql = 'UPDATE ' . $this->table_prefix . "users SET user_timezone = '" . $this->db->sql_escape($this->convert_phpbb30_timezone($row['user_timezone'], $row['user_dst'])) . "' WHERE user_timezone = '" . $this->db->sql_escape($row['user_timezone']) . "' @@ -57,6 +63,12 @@ class timezone extends \phpbb\db\migration\migration } $this->db->sql_freeresult($result); + if ($converted_timezones == $limit) + { + // There are still more to convert + return $start + $limit; + } + // Update board default timezone $sql = 'UPDATE ' . $this->table_prefix . "config SET config_value = '" . $this->convert_phpbb30_timezone($this->config['board_timezone'], $this->config['board_dst']) . "' |