diff options
Diffstat (limited to 'phpBB/install/database_update.php')
| -rw-r--r-- | phpBB/install/database_update.php | 45 | 
1 files changed, 44 insertions, 1 deletions
| diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0ffab8e413..1408db27be 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1071,6 +1071,14 @@ function database_update_info()  		'3.0.10-RC3'	=> array(),  		// No changes from 3.0.10 to 3.0.11-RC1  		'3.0.10'		=> array(), +		// Changes from 3.0.11-RC1 to 3.0.11-RC2 +		'3.0.11-RC1'	=> array( +			'add_columns'		=> array( +				PROFILE_FIELDS_TABLE			=> array( +					'field_show_novalue'		=> array('BOOL', 0), +				), +			), +		),  		/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 */ @@ -1109,6 +1117,9 @@ function database_update_info()  				GROUPS_TABLE		=> array(  					'group_legend'		=> array('UINT', 0),  				), +				USERS_TABLE			=> array( +					'user_timezone'		=> array('VCHAR:100', ''), +				),  			),  		),  	); @@ -1123,6 +1134,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 +1981,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,  				); @@ -2205,6 +2218,10 @@ function change_database_data(&$no_updates, $version)  			$no_updates = false;  		break; +		// No changes from 3.0.11-RC1 to 3.0.11-RC2 +		case '3.0.11-RC1': +		break; +  		// Changes from 3.1.0-dev to 3.1.0-A1  		case '3.1.0-dev': @@ -2617,6 +2634,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;  	}  } | 
