From ea5ae09c7d899bd0daa2b8b18371d6c4fbba4c5e Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Fri, 6 Apr 2012 14:09:56 +0530 Subject: [ticket/10561] Added section in database_update.php Added section to check for existing users using a deactivated style, and revert it to default style. PHPBB3-10561 --- phpBB/install/database_update.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index a1b7dcd47f..91016273e6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1871,6 +1871,24 @@ function change_database_data(&$no_updates, $version) } // end Bing Bot addition + // Updates users having current style a deactivated one + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_active = 0'; + $result = $db->sql_query($sql); + + while($temp = $db->sql_fetchfield('style_id', false, $result)) + { + $styles[] = $temp; + } + + $db->sql_freeresult($result); + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . $config['default_style'] .' + WHERE ' . $db->sql_in_set('user_style', $styles); + $result = $db->sql_query($sql); + $db->sql_freeresult($result); + // Delete shadow topics pointing to not existing topics $batch_size = 500; -- cgit v1.2.1 From 1808a61fe3e89399aec4ecced36e270faa7d0beb Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Sat, 7 Apr 2012 19:42:42 +0530 Subject: [ticket/10561] Added to database_update:database_update_info() Updates made to database_update.php PHPBB3-10561 --- phpBB/install/database_update.php | 45 +++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 91016273e6..096d90219b 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -993,6 +993,8 @@ function database_update_info() '3.0.10-RC2' => array(), // No changes from 3.0.10-RC3 to 3.0.10 '3.0.10-RC3' => array(), + // No changes from 3.0.10 to 3.0.11-RC1 + '3.0.10' => array(), /** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.11-RC1 */ ); @@ -1871,24 +1873,6 @@ function change_database_data(&$no_updates, $version) } // end Bing Bot addition - // Updates users having current style a deactivated one - $sql = 'SELECT style_id - FROM ' . STYLES_TABLE . ' - WHERE style_active = 0'; - $result = $db->sql_query($sql); - - while($temp = $db->sql_fetchfield('style_id', false, $result)) - { - $styles[] = $temp; - } - - $db->sql_freeresult($result); - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . $config['default_style'] .' - WHERE ' . $db->sql_in_set('user_style', $styles); - $result = $db->sql_query($sql); - $db->sql_freeresult($result); - // Delete shadow topics pointing to not existing topics $batch_size = 500; @@ -2042,6 +2026,31 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.10-RC3 to 3.0.10 case '3.0.10-RC3': break; + + // Changes from 3.0.10 to 3.0.11-RC1 + case '3.0.10': + // Updates users having current style a deactivated one + $deactivated_style_ids = array(); + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_active = 0'; + $result = $db->sql_query($sql); + + while ($temp_style_id = $db->sql_fetchfield('style_id', false, $result)) + { + $deactivated_style_ids[] = (int) $temp_style_id; + } + + $db->sql_freeresult($result); + if (!empty($deactivated_style_ids)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . $config['default_style'] .' + WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids); + $result = $db->sql_query($sql); + } + $no_updates = false; + break; } } -- cgit v1.2.1 From 03a35581c4b0dcb7c20885d4ca807ea7117872cb Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Sat, 7 Apr 2012 23:15:12 +0530 Subject: [ticket/10561] Reverted to phpbb_style_is_active() Changes made to function name, reverted to old. PHPBB3-10561 --- phpBB/install/database_update.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 096d90219b..8f00b18846 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2030,18 +2030,18 @@ function change_database_data(&$no_updates, $version) // Changes from 3.0.10 to 3.0.11-RC1 case '3.0.10': // Updates users having current style a deactivated one - $deactivated_style_ids = array(); $sql = 'SELECT style_id FROM ' . STYLES_TABLE . ' WHERE style_active = 0'; $result = $db->sql_query($sql); + $deactivated_style_ids = array(); while ($temp_style_id = $db->sql_fetchfield('style_id', false, $result)) { $deactivated_style_ids[] = (int) $temp_style_id; } - $db->sql_freeresult($result); + if (!empty($deactivated_style_ids)) { $sql = 'UPDATE ' . USERS_TABLE . ' @@ -2049,6 +2049,7 @@ function change_database_data(&$no_updates, $version) WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids); $result = $db->sql_query($sql); } + $no_updates = false; break; } -- cgit v1.2.1 From 4e630ef1601ef39c7947de7d071fdccf68f52e3b Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Mon, 9 Apr 2012 00:33:55 +0530 Subject: [ticket/10561] Casted $config['default_style'] to int PHPBB3-10561 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 8f00b18846..576b3c0ba8 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2045,7 +2045,7 @@ function change_database_data(&$no_updates, $version) if (!empty($deactivated_style_ids)) { $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . $config['default_style'] .' + SET user_style = ' . (int) $config['default_style'] .' WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids); $result = $db->sql_query($sql); } -- cgit v1.2.1 From 8442b19e59e3d07129c3ef5286ada84a3ac64b98 Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Mon, 9 Apr 2012 01:04:17 +0530 Subject: [ticket/10561] Changed $temp_style_id to $style_id PHPBB3-10561 --- phpBB/install/database_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 576b3c0ba8..ba89a07e92 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2036,9 +2036,9 @@ function change_database_data(&$no_updates, $version) $result = $db->sql_query($sql); $deactivated_style_ids = array(); - while ($temp_style_id = $db->sql_fetchfield('style_id', false, $result)) + while ($style_id = $db->sql_fetchfield('style_id', false, $result)) { - $deactivated_style_ids[] = (int) $temp_style_id; + $deactivated_style_ids[] = (int) $style_id; } $db->sql_freeresult($result); -- cgit v1.2.1 From 2a48284fc9125edad2dbd9de41dfb1ef61926b6b Mon Sep 17 00:00:00 2001 From: Hari Sankar R Date: Mon, 9 Apr 2012 01:25:17 +0530 Subject: [ticket/10561] Removed extra tabs, changes made to $db->sql_query() Substituted $db->sql_query() with _sql() PHPBB3-10561 --- phpBB/install/database_update.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index ba89a07e92..6097341ace 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2031,8 +2031,8 @@ function change_database_data(&$no_updates, $version) case '3.0.10': // Updates users having current style a deactivated one $sql = 'SELECT style_id - FROM ' . STYLES_TABLE . ' - WHERE style_active = 0'; + FROM ' . STYLES_TABLE . ' + WHERE style_active = 0'; $result = $db->sql_query($sql); $deactivated_style_ids = array(); @@ -2045,9 +2045,9 @@ function change_database_data(&$no_updates, $version) if (!empty($deactivated_style_ids)) { $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_style = ' . (int) $config['default_style'] .' - WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids); - $result = $db->sql_query($sql); + SET user_style = ' . (int) $config['default_style'] .' + WHERE ' . $db->sql_in_set('user_style', $deactivated_style_ids); + _sql($sql, $errored, $error_ary); } $no_updates = false; -- cgit v1.2.1