aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php33
1 files changed, 32 insertions, 1 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 594397c815..6e99fd56a0 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1109,6 +1109,9 @@ function database_update_info()
GROUPS_TABLE => array(
'group_legend' => array('UINT', 0),
),
+ USERS_TABLE => array(
+ 'user_timezone' => array('VCHAR:100', ''),
+ ),
),
),
);
@@ -1123,6 +1126,8 @@ function change_database_data(&$no_updates, $version)
{
global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx, $db_tools;
+ $update_helpers = new phpbb_update_helpers();
+
switch ($version)
{
case '3.0.0':
@@ -1968,7 +1973,7 @@ function change_database_data(&$no_updates, $version)
'user_email' => '',
'user_lang' => $config['default_lang'],
'user_style' => $config['default_style'],
- 'user_timezone' => 0,
+ 'user_timezone' => 'UTC',
'user_dateformat' => $config['default_dateformat'],
'user_allow_massemail' => 0,
);
@@ -2607,6 +2612,32 @@ function change_database_data(&$no_updates, $version)
$config->set('assets_version', '1');
}
+ // If the column exists, we did not yet update the users timezone
+ if ($db_tools->sql_column_exists(USERS_TABLE, 'user_dst'))
+ {
+ // Update user timezones
+ $sql = 'SELECT user_dst, user_timezone
+ FROM ' . USERS_TABLE . '
+ GROUP BY user_timezone, user_dst';
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_timezone = '" . $db->sql_escape($update_helpers->convert_phpbb30_timezone($row['user_timezone'], $row['user_dst'])) . "'
+ WHERE user_timezone = '" . $db->sql_escape($row['user_timezone']) . "'
+ AND user_dst = " . (int) $row['user_dst'];
+ _sql($sql, $errored, $error_ary);
+ }
+ $db->sql_freeresult($result);
+
+ // Update board default timezone
+ set_config('board_timezone', $update_helpers->convert_phpbb30_timezone($config['board_timezone'], $config['board_dst']));
+
+ // After we have calculated the timezones we can delete user_dst column from user table.
+ $db_tools->sql_column_remove(USERS_TABLE, 'user_dst');
+ }
+
break;
}
}