From 023a10208216a78c32994a5d7997299cf3b5fdae Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 9 Feb 2011 21:03:37 +0100 Subject: [PATCH] [ticket/9549] Update database with the new config values and columns PHPBB3-9549 --- phpBB/develop/create_schema_files.php | 3 +- phpBB/install/database_update.php | 65 ++++++++++++++++++++++- phpBB/install/schemas/firebird_schema.sql | 3 +- phpBB/install/schemas/mssql_schema.sql | 3 +- phpBB/install/schemas/mysql_40_schema.sql | 3 +- phpBB/install/schemas/mysql_41_schema.sql | 3 +- phpBB/install/schemas/oracle_schema.sql | 3 +- phpBB/install/schemas/postgres_schema.sql | 3 +- phpBB/install/schemas/schema_data.sql | 17 +++--- phpBB/install/schemas/sqlite_schema.sql | 3 +- 10 files changed, 89 insertions(+), 17 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index c0ec876397..5c648d44ad 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1146,7 +1146,8 @@ function get_schema_struct() 'group_receive_pm' => array('BOOL', 0), 'group_message_limit' => array('UINT', 0), 'group_max_recipients' => array('UINT', 0), - 'group_legend' => array('BOOL', 1), + 'group_legend' => array('UINT', 0), + 'group_teampage' => array('UINT', 0), ), 'PRIMARY_KEY' => 'group_id', 'KEYS' => array( diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0c17c18b5e..9e8a063f44 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -920,8 +920,19 @@ function database_update_info() '3.0.7-PL1' => array(), // No changes from 3.0.8-RC1 to 3.0.8 '3.0.8-RC1' => array(), - // No changes from 3.1.0-dev to 3.1.0-A1 - '3.1.0-dev' => array(), + // Changes from 3.1.0-dev to 3.1.0-A1 + '3.1.0-dev' => array( + 'add_columns' => array( + GROUPS_TABLE => array( + 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), + ), + ), + 'change_columns' => array( + GROUPS_TABLE => array( + 'group_legend' => array('UINT', 0), + ), + ), + ), ); } @@ -1868,6 +1879,56 @@ function change_database_data(&$no_updates, $version) // Changes from 3.1.0-dev to 3.1.0-A1 case '3.1.0-dev': set_config('use_system_cron', 0); + + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = 1 + WHERE group_type = ' . GROUP_SPECIAL . " + AND group_name = 'ADMINISTRATORS'"; + _sql($sql, $errored, $error_ary); + + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_teampage = 2 + WHERE group_type = ' . GROUP_SPECIAL . " + AND group_name = 'GLOBAL_MODERATORS'"; + _sql($sql, $errored, $error_ary); + + set_config('legend_sort_groupname', '1'); + set_config('teampage_multiple', '1'); + set_config('teampage_forums', '1'); + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . ' + WHERE group_legend = 1 + ORDER BY group_name ASC'; + $result = $db->sql_query($sql); + + $next_legend = 1; + while ($row = $db->sql_fetchrow($result)) + { + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_legend = ' . $next_legend . ' + WHERE group_id = ' . (int) $row['group_id']; + _sql($sql, $errored, $error_ary); + + $next_legend++; + } + $db->sql_freeresult($result); + unset($next_legend); + + // Install modules + $modules_to_install = array( + 'position' => array( + 'base' => 'groups', + 'class' => 'acp', + 'title' => 'ACP_GROUPS_POSITION', + 'auth' => 'acl_a_group', + 'cat' => 'ACP_GROUPS', + ), + ); + + _add_modules($modules_to_install); + + $no_updates = false; break; } } diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index ab622e8fde..e16b4ab64c 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -444,7 +444,8 @@ CREATE TABLE phpbb_groups ( group_receive_pm INTEGER DEFAULT 0 NOT NULL, group_message_limit INTEGER DEFAULT 0 NOT NULL, group_max_recipients INTEGER DEFAULT 0 NOT NULL, - group_legend INTEGER DEFAULT 1 NOT NULL + group_legend INTEGER DEFAULT 0 NOT NULL, + group_teampage INTEGER DEFAULT 0 NOT NULL );; ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 068373c9a1..a14e246c8f 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -546,7 +546,8 @@ CREATE TABLE [phpbb_groups] ( [group_receive_pm] [int] DEFAULT (0) NOT NULL , [group_message_limit] [int] DEFAULT (0) NOT NULL , [group_max_recipients] [int] DEFAULT (0) NOT NULL , - [group_legend] [int] DEFAULT (1) NOT NULL + [group_legend] [int] DEFAULT (0) NOT NULL , + [group_teampage] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index 813cf8613f..35ef8e1af5 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -316,7 +316,8 @@ CREATE TABLE phpbb_groups ( group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (group_id), KEY group_legend_name (group_legend, group_name(255)) ); diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 97369d2bf7..7f503cdcdb 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -316,7 +316,8 @@ CREATE TABLE phpbb_groups ( group_receive_pm tinyint(1) UNSIGNED DEFAULT '0' NOT NULL, group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - group_legend tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, + group_legend mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + group_teampage mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, PRIMARY KEY (group_id), KEY group_legend_name (group_legend, group_name) ) CHARACTER SET `utf8` COLLATE `utf8_bin`; diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 7be7cd0756..d0b8943b5d 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -605,7 +605,8 @@ CREATE TABLE phpbb_groups ( group_receive_pm number(1) DEFAULT '0' NOT NULL, group_message_limit number(8) DEFAULT '0' NOT NULL, group_max_recipients number(8) DEFAULT '0' NOT NULL, - group_legend number(1) DEFAULT '1' NOT NULL, + group_legend number(8) DEFAULT '0' NOT NULL, + group_teampage number(8) DEFAULT '0' NOT NULL, CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id) ) / diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 9cdf35024b..18110b29f4 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -459,7 +459,8 @@ CREATE TABLE phpbb_groups ( group_receive_pm INT2 DEFAULT '0' NOT NULL CHECK (group_receive_pm >= 0), group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 0), group_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0), - group_legend INT2 DEFAULT '1' NOT NULL CHECK (group_legend >= 0), + group_legend INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0), + group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0), PRIMARY KEY (group_id) ); diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 5ced24034c..7c4caeadba 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -151,6 +151,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_server', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_uid', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ldap_user_filter', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('legend_sort_groupname', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_load', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('limit_search_load', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_anon_lastread', '0'); @@ -238,6 +239,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_host', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_password', ''); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_port', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('smtp_username', ''); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_multiple', '1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('teampage_forums', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', '25'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); @@ -520,13 +523,13 @@ INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_reg INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd) VALUES (3, 5, 'Admin', 'admin', 0, '21232f297a57a5a743894a0e4a801fc3', 'admin@yourdomain.com', 'en', 1, 1, 'AA0000', 1, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); # -- Groups -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, '', '', '', 5); -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, '', '', '', 5); -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, '', '', '', 5); -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 1, '', '', '', 0); -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, '', '', '', 0); -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, '', '', '', 5); -INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GUESTS', 3, 0, '', 0, 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED', 3, 0, '', 0, 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('REGISTERED_COPPA', 3, 0, '', 0, 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('GLOBAL_MODERATORS', 3, 0, '00AA00', 2, 2, '', '', '', 0); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('ADMINISTRATORS', 3, 1, 'AA0000', 1, 1, '', '', '', 0); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('BOTS', 3, 0, '9E8DA7', 0, 0, '', '', '', 5); +INSERT INTO phpbb_groups (group_name, group_type, group_founder_manage, group_colour, group_legend, group_teampage, group_avatar, group_desc, group_desc_uid, group_max_recipients) VALUES ('NEWLY_REGISTERED', 3, 0, '', 0, 0, '', '', '', 5); # -- User -> Group INSERT INTO phpbb_user_group (group_id, user_id, user_pending, group_leader) VALUES (1, 1, 0, 0); diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 34b4b05478..719e3e36fe 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -308,7 +308,8 @@ CREATE TABLE phpbb_groups ( group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0', group_message_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', group_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0', - group_legend INTEGER UNSIGNED NOT NULL DEFAULT '1' + group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0', + group_teampage INTEGER UNSIGNED NOT NULL DEFAULT '0' ); CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);