[ticket/10759] Retrieve style_id after INSERT since we cannot set it

PHPBB3-10759
This commit is contained in:
Nils Adermann 2012-04-19 03:18:20 +02:00
parent ea8f83de6f
commit c433730686

View file

@ -2503,10 +2503,17 @@ function change_database_data(&$no_updates, $version)
// No valid styles: remove everything and add prosilver // No valid styles: remove everything and add prosilver
_sql('DELETE FROM ' . STYLES_TABLE, $errored, $error_ary); _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); _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 = 'UPDATE ' . USERS_TABLE . ' SET user_style = 0';
_sql($sql, $errored, $error_ary); _sql($sql, $errored, $error_ary);