From c43373068636a4f361423f2fe41231ac2e32f70f Mon Sep 17 00:00:00 2001 From: Nils Adermann <naderman@naderman.de> Date: Thu, 19 Apr 2012 03:18:20 +0200 Subject: [ticket/10759] Retrieve style_id after INSERT since we cannot set it PHPBB3-10759 --- phpBB/install/database_update.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'phpBB/install') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index cddc1c4164..d71226a29c 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2503,10 +2503,17 @@ function change_database_data(&$no_updates, $version) // No valid styles: remove everything and add prosilver _sql('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary); - $sql = 'INSERT INTO ' . STYLES_TABLE . " (style_id, style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES (1, 'prosilver', '© phpBB Group', 1, 'prosilver', 'kNg=', 0, '')"; + $sql = 'INSERT INTO ' . STYLES_TABLE . " (style_name, style_copyright, style_active, style_path, bbcode_bitfield, style_parent_id, style_parent_tree) VALUES ('prosilver', '© phpBB Group', 1, 'prosilver', 'kNg=', 0, '')"; _sql($sql, $errored, $error_ary); - set_config('default_style', '1'); + $sql = 'SELECT style_id + FROM ' . $table . " + WHERE style_name = 'prosilver'"; + $result = _sql($sql, $errored, $error_ary); + $default_style = $db->sql_fetchfield($result); + $db->sql_freeresult($result); + + set_config('default_style', $default_style); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0'; _sql($sql, $errored, $error_ary); -- cgit v1.2.1