diff options
Diffstat (limited to 'phpBB/install')
-rw-r--r-- | phpBB/install/database_update.php | 52 | ||||
-rw-r--r-- | phpBB/install/schemas/firebird_schema.sql | 26 | ||||
-rw-r--r-- | phpBB/install/schemas/mssql_schema.sql | 23 | ||||
-rw-r--r-- | phpBB/install/schemas/mysql_40_schema.sql | 12 | ||||
-rw-r--r-- | phpBB/install/schemas/mysql_41_schema.sql | 12 | ||||
-rw-r--r-- | phpBB/install/schemas/oracle_schema.sql | 31 | ||||
-rw-r--r-- | phpBB/install/schemas/postgres_schema.sql | 16 | ||||
-rw-r--r-- | phpBB/install/schemas/sqlite_schema.sql | 13 |
8 files changed, 159 insertions, 26 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0a065573bf..8592b03be7 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1165,11 +1165,18 @@ function database_update_info() 'ext_name' => array('UNIQUE', 'ext_name'), ), ), + TEAMPAGE_TABLE => array( + 'COLUMNS' => array( + 'teampage_id' => array('UINT', NULL, 'auto_increment'), + 'group_id' => array('UINT', 0), + 'teampage_name' => array('VCHAR_UNI:255', ''), + 'teampage_position' => array('UINT', 0), + 'teampage_parent' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'teampage_id', + ), ), 'add_columns' => array( - GROUPS_TABLE => array( - 'group_teampage' => array('UINT', 0, 'after' => 'group_legend'), - ), PROFILE_FIELDS_TABLE => array( 'field_show_on_pm' => array('BOOL', 0), ), @@ -2475,26 +2482,39 @@ function change_database_data(&$no_updates, $version) set_config('use_system_cron', 0); } - $sql = 'SELECT group_teampage - FROM ' . GROUPS_TABLE . ' - WHERE group_teampage > 0'; + $sql = 'SELECT teampage_id + FROM ' . TEAMPAGE_TABLE; $result = $db->sql_query_limit($sql, 1); - $added_groups_teampage = (bool) $db->sql_fetchfield('group_teampage'); + $added_groups_teampage = (bool) $db->sql_fetchfield('teampage_id'); $db->sql_freeresult($result); if (!$added_groups_teampage) { - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_teampage = 1 + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' WHERE group_type = ' . GROUP_SPECIAL . " - AND group_name = 'ADMINISTRATORS'"; - _sql($sql, $errored, $error_ary); + AND (group_name = 'ADMINISTRATORS' + OR group_name = 'GLOBAL_MODERATORS') + ORDER BY group_name ASC"; + $result = $db->sql_query($sql); - $sql = 'UPDATE ' . GROUPS_TABLE . ' - SET group_teampage = 2 - WHERE group_type = ' . GROUP_SPECIAL . " - AND group_name = 'GLOBAL_MODERATORS'"; - _sql($sql, $errored, $error_ary); + $teampage_entries = array(); + while ($row = $db->sql_fetchrow($result)) + { + $teampage_entries[] = array( + 'group_id' => (int) $row['group_id'], + 'teampage_name' => '', + 'teampage_position' => sizeof($teampage_entries) + 1, + 'teampage_parent' => 0, + ); + } + $db->sql_freeresult($result); + + if (sizeof($teampage_entries)) + { + $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_entries); + } + unset($teampage_entries); } if (!isset($config['legend_sort_groupname'])) diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index c4818215e4..beb1418d56 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -454,8 +454,7 @@ 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 0 NOT NULL, - group_teampage INTEGER DEFAULT 0 NOT NULL + group_legend INTEGER DEFAULT 0 NOT NULL );; ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);; @@ -1128,6 +1127,29 @@ BEGIN END;; +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id INTEGER NOT NULL, + group_id INTEGER DEFAULT 0 NOT NULL, + teampage_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + teampage_position INTEGER DEFAULT 0 NOT NULL, + teampage_parent INTEGER DEFAULT 0 NOT NULL +);; + +ALTER TABLE phpbb_teampage ADD PRIMARY KEY (teampage_id);; + + +CREATE GENERATOR phpbb_teampage_gen;; +SET GENERATOR phpbb_teampage_gen TO 0;; + +CREATE TRIGGER t_phpbb_teampage FOR phpbb_teampage +BEFORE INSERT +AS +BEGIN + NEW.teampage_id = GEN_ID(phpbb_teampage_gen, 1); +END;; + + # Table: 'phpbb_topics' CREATE TABLE phpbb_topics ( topic_id INTEGER NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 709f83917e..aa48b2a9ed 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -562,8 +562,7 @@ 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 (0) NOT NULL , - [group_teampage] [int] DEFAULT (0) NOT NULL + [group_legend] [int] DEFAULT (0) NOT NULL ) ON [PRIMARY] GO @@ -1370,6 +1369,26 @@ GO /* + Table: 'phpbb_teampage' +*/ +CREATE TABLE [phpbb_teampage] ( + [teampage_id] [int] IDENTITY (1, 1) NOT NULL , + [group_id] [int] DEFAULT (0) NOT NULL , + [teampage_name] [varchar] (255) DEFAULT ('') NOT NULL , + [teampage_position] [int] DEFAULT (0) NOT NULL , + [teampage_parent] [int] DEFAULT (0) NOT NULL +) ON [PRIMARY] +GO + +ALTER TABLE [phpbb_teampage] WITH NOCHECK ADD + CONSTRAINT [PK_phpbb_teampage] PRIMARY KEY CLUSTERED + ( + [teampage_id] + ) ON [PRIMARY] +GO + + +/* Table: 'phpbb_topics' */ CREATE TABLE [phpbb_topics] ( diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index c905dda77e..68daab5808 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -327,7 +327,6 @@ CREATE TABLE phpbb_groups ( group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' 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)) ); @@ -789,6 +788,17 @@ CREATE TABLE phpbb_styles ( ); +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_name blob NOT NULL, + teampage_position mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_parent mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (teampage_id) +); + + # Table: 'phpbb_topics' CREATE TABLE phpbb_topics ( topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index b5d7c70c10..8c7739feae 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -327,7 +327,6 @@ CREATE TABLE phpbb_groups ( group_message_limit mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, group_max_recipients mediumint(8) UNSIGNED DEFAULT '0' 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`; @@ -789,6 +788,17 @@ CREATE TABLE phpbb_styles ( ) CHARACTER SET `utf8` COLLATE `utf8_bin`; +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id mediumint(8) UNSIGNED NOT NULL auto_increment, + group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_name varchar(255) DEFAULT '' NOT NULL, + teampage_position mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + teampage_parent mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + PRIMARY KEY (teampage_id) +) CHARACTER SET `utf8` COLLATE `utf8_bin`; + + # Table: 'phpbb_topics' CREATE TABLE phpbb_topics ( topic_id mediumint(8) UNSIGNED NOT NULL auto_increment, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index e2bdb2385b..e20b0c4c9a 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -620,7 +620,6 @@ CREATE TABLE phpbb_groups ( group_message_limit number(8) DEFAULT '0' NOT NULL, group_max_recipients number(8) DEFAULT '0' 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) ) / @@ -1494,6 +1493,36 @@ END; /* + Table: 'phpbb_teampage' +*/ +CREATE TABLE phpbb_teampage ( + teampage_id number(8) NOT NULL, + group_id number(8) DEFAULT '0' NOT NULL, + teampage_name varchar2(765) DEFAULT '' , + teampage_position number(8) DEFAULT '0' NOT NULL, + teampage_parent number(8) DEFAULT '0' NOT NULL, + CONSTRAINT pk_phpbb_teampage PRIMARY KEY (teampage_id) +) +/ + + +CREATE SEQUENCE phpbb_teampage_seq +/ + +CREATE OR REPLACE TRIGGER t_phpbb_teampage +BEFORE INSERT ON phpbb_teampage +FOR EACH ROW WHEN ( + new.teampage_id IS NULL OR new.teampage_id = 0 +) +BEGIN + SELECT phpbb_teampage_seq.nextval + INTO :new.teampage_id + FROM dual; +END; +/ + + +/* Table: 'phpbb_topics' */ CREATE TABLE phpbb_topics ( diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index 41d510e4c3..69cfa2159c 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -473,7 +473,6 @@ CREATE TABLE phpbb_groups ( 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 INT4 DEFAULT '0' NOT NULL CHECK (group_legend >= 0), - group_teampage INT4 DEFAULT '0' NOT NULL CHECK (group_teampage >= 0), PRIMARY KEY (group_id) ); @@ -1026,6 +1025,21 @@ CREATE TABLE phpbb_styles ( CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); /* + Table: 'phpbb_teampage' +*/ +CREATE SEQUENCE phpbb_teampage_seq; + +CREATE TABLE phpbb_teampage ( + teampage_id INT4 DEFAULT nextval('phpbb_teampage_seq'), + group_id INT4 DEFAULT '0' NOT NULL CHECK (group_id >= 0), + teampage_name varchar(255) DEFAULT '' NOT NULL, + teampage_position INT4 DEFAULT '0' NOT NULL CHECK (teampage_position >= 0), + teampage_parent INT4 DEFAULT '0' NOT NULL CHECK (teampage_parent >= 0), + PRIMARY KEY (teampage_id) +); + + +/* Table: 'phpbb_topics' */ CREATE SEQUENCE phpbb_topics_seq; diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index fe028bd12c..ba9028b0e9 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -318,8 +318,7 @@ 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 '0', - group_teampage INTEGER UNSIGNED NOT NULL DEFAULT '0' + group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0' ); CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name); @@ -764,6 +763,16 @@ CREATE TABLE phpbb_styles ( CREATE UNIQUE INDEX phpbb_styles_style_name ON phpbb_styles (style_name); +# Table: 'phpbb_teampage' +CREATE TABLE phpbb_teampage ( + teampage_id INTEGER PRIMARY KEY NOT NULL , + group_id INTEGER UNSIGNED NOT NULL DEFAULT '0', + teampage_name varchar(255) NOT NULL DEFAULT '', + teampage_position INTEGER UNSIGNED NOT NULL DEFAULT '0', + teampage_parent INTEGER UNSIGNED NOT NULL DEFAULT '0' +); + + # Table: 'phpbb_topics' CREATE TABLE phpbb_topics ( topic_id INTEGER PRIMARY KEY NOT NULL , |