mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10411] Update schema and fix database update
PHPBB3-10411
This commit is contained in:
parent
6e286218ec
commit
8fc022033a
9 changed files with 39 additions and 27 deletions
|
@ -1178,7 +1178,6 @@ function get_schema_struct()
|
||||||
'group_message_limit' => array('UINT', 0),
|
'group_message_limit' => array('UINT', 0),
|
||||||
'group_max_recipients' => array('UINT', 0),
|
'group_max_recipients' => array('UINT', 0),
|
||||||
'group_legend' => array('UINT', 0),
|
'group_legend' => array('UINT', 0),
|
||||||
'group_teampage' => array('UINT', 0),
|
|
||||||
),
|
),
|
||||||
'PRIMARY_KEY' => 'group_id',
|
'PRIMARY_KEY' => 'group_id',
|
||||||
'KEYS' => array(
|
'KEYS' => array(
|
||||||
|
|
|
@ -1107,11 +1107,18 @@ function database_update_info()
|
||||||
'ext_name' => array('UNIQUE', 'ext_name'),
|
'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(
|
'add_columns' => array(
|
||||||
GROUPS_TABLE => array(
|
|
||||||
'group_teampage' => array('UINT', 0, 'after' => 'group_legend'),
|
|
||||||
),
|
|
||||||
PROFILE_FIELDS_TABLE => array(
|
PROFILE_FIELDS_TABLE => array(
|
||||||
'field_show_on_pm' => array('BOOL', 0),
|
'field_show_on_pm' => array('BOOL', 0),
|
||||||
),
|
),
|
||||||
|
@ -2381,26 +2388,39 @@ function change_database_data(&$no_updates, $version)
|
||||||
set_config('use_system_cron', 0);
|
set_config('use_system_cron', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = 'SELECT group_teampage
|
$sql = 'SELECT teampage_id
|
||||||
FROM ' . GROUPS_TABLE . '
|
FROM ' . TEAMPAGE_TABLE;
|
||||||
WHERE group_teampage > 0';
|
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$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);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if (!$added_groups_teampage)
|
if (!$added_groups_teampage)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
$sql = 'SELECT *
|
||||||
SET group_teampage = 1
|
FROM ' . GROUPS_TABLE . '
|
||||||
WHERE group_type = ' . GROUP_SPECIAL . "
|
WHERE group_type = ' . GROUP_SPECIAL . "
|
||||||
AND group_name = 'ADMINISTRATORS'";
|
AND (group_name = 'ADMINISTRATORS'
|
||||||
_sql($sql, $errored, $error_ary);
|
OR group_name = 'GLOBAL_MODERATORS')
|
||||||
|
ORDER BY group_name ASC";
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . GROUPS_TABLE . '
|
$teampage_entries = array();
|
||||||
SET group_teampage = 2
|
while ($row = $db->sql_fetchrow($result))
|
||||||
WHERE group_type = ' . GROUP_SPECIAL . "
|
{
|
||||||
AND group_name = 'GLOBAL_MODERATORS'";
|
$teampage_entries[] = array(
|
||||||
_sql($sql, $errored, $error_ary);
|
'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']))
|
if (!isset($config['legend_sort_groupname']))
|
||||||
|
|
|
@ -454,8 +454,7 @@ CREATE TABLE phpbb_groups (
|
||||||
group_receive_pm INTEGER DEFAULT 0 NOT NULL,
|
group_receive_pm INTEGER DEFAULT 0 NOT NULL,
|
||||||
group_message_limit INTEGER DEFAULT 0 NOT NULL,
|
group_message_limit INTEGER DEFAULT 0 NOT NULL,
|
||||||
group_max_recipients INTEGER DEFAULT 0 NOT NULL,
|
group_max_recipients INTEGER DEFAULT 0 NOT NULL,
|
||||||
group_legend INTEGER DEFAULT 0 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);;
|
ALTER TABLE phpbb_groups ADD PRIMARY KEY (group_id);;
|
||||||
|
|
|
@ -562,8 +562,7 @@ CREATE TABLE [phpbb_groups] (
|
||||||
[group_receive_pm] [int] DEFAULT (0) NOT NULL ,
|
[group_receive_pm] [int] DEFAULT (0) NOT NULL ,
|
||||||
[group_message_limit] [int] DEFAULT (0) NOT NULL ,
|
[group_message_limit] [int] DEFAULT (0) NOT NULL ,
|
||||||
[group_max_recipients] [int] DEFAULT (0) NOT NULL ,
|
[group_max_recipients] [int] DEFAULT (0) NOT NULL ,
|
||||||
[group_legend] [int] DEFAULT (0) NOT NULL ,
|
[group_legend] [int] DEFAULT (0) NOT NULL
|
||||||
[group_teampage] [int] DEFAULT (0) NOT NULL
|
|
||||||
) ON [PRIMARY]
|
) ON [PRIMARY]
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,6 @@ CREATE TABLE phpbb_groups (
|
||||||
group_message_limit mediumint(8) 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_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
group_legend 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),
|
PRIMARY KEY (group_id),
|
||||||
KEY group_legend_name (group_legend, group_name(255))
|
KEY group_legend_name (group_legend, group_name(255))
|
||||||
);
|
);
|
||||||
|
|
|
@ -327,7 +327,6 @@ CREATE TABLE phpbb_groups (
|
||||||
group_message_limit mediumint(8) 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_max_recipients mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
|
||||||
group_legend 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),
|
PRIMARY KEY (group_id),
|
||||||
KEY group_legend_name (group_legend, group_name)
|
KEY group_legend_name (group_legend, group_name)
|
||||||
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
|
||||||
|
|
|
@ -620,7 +620,6 @@ CREATE TABLE phpbb_groups (
|
||||||
group_message_limit number(8) DEFAULT '0' NOT NULL,
|
group_message_limit number(8) DEFAULT '0' NOT NULL,
|
||||||
group_max_recipients number(8) DEFAULT '0' NOT NULL,
|
group_max_recipients number(8) DEFAULT '0' NOT NULL,
|
||||||
group_legend 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)
|
CONSTRAINT pk_phpbb_groups PRIMARY KEY (group_id)
|
||||||
)
|
)
|
||||||
/
|
/
|
||||||
|
|
|
@ -473,7 +473,6 @@ CREATE TABLE phpbb_groups (
|
||||||
group_message_limit INT4 DEFAULT '0' NOT NULL CHECK (group_message_limit >= 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_max_recipients INT4 DEFAULT '0' NOT NULL CHECK (group_max_recipients >= 0),
|
||||||
group_legend INT4 DEFAULT '0' 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)
|
PRIMARY KEY (group_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -318,8 +318,7 @@ CREATE TABLE phpbb_groups (
|
||||||
group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
group_receive_pm INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||||
group_message_limit 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_max_recipients INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
||||||
group_legend INTEGER UNSIGNED NOT NULL DEFAULT '0',
|
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);
|
CREATE INDEX phpbb_groups_group_legend_name ON phpbb_groups (group_legend, group_name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue