diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-11-02 12:49:28 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-11-02 13:25:46 +0100 |
commit | cb8cd50495eb9d75cae8e7f1450033acfdb0b374 (patch) | |
tree | 22bc1832b3818e6335a71b4414fad223bb4bcc35 | |
parent | 85a12ce4f412fb307e6d23706936e493b8bc7b3d (diff) | |
download | forums-cb8cd50495eb9d75cae8e7f1450033acfdb0b374.tar forums-cb8cd50495eb9d75cae8e7f1450033acfdb0b374.tar.gz forums-cb8cd50495eb9d75cae8e7f1450033acfdb0b374.tar.bz2 forums-cb8cd50495eb9d75cae8e7f1450033acfdb0b374.tar.xz forums-cb8cd50495eb9d75cae8e7f1450033acfdb0b374.zip |
[ticket/11031] Correctly add groups to teampage
PHPBB3-11031
-rw-r--r-- | phpBB/includes/functions_convert.php | 34 | ||||
-rw-r--r-- | phpBB/install/convertors/convert_phpbb20.php | 6 | ||||
-rw-r--r-- | phpBB/install/convertors/functions_phpbb20.php | 40 |
3 files changed, 78 insertions, 2 deletions
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 10d5abed76..cdab8f2491 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1748,7 +1748,7 @@ function add_default_groups() 'group_type' => GROUP_SPECIAL, 'group_colour' => (string) $data[0], 'group_legend' => (int) $data[1], - 'group_founder_manage' => (int) $data[2] + 'group_founder_manage' => (int) $data[2], ); } @@ -1758,6 +1758,38 @@ function add_default_groups() } } +function add_groups_to_teampage() +{ + global $db; + + $teampage_groups = array( + 'ADMINISTRATORS' => 1, + 'GLOBAL_MODERATORS' => 2, + ); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', array_keys($teampage_groups)); + $result = $db->sql_query($sql); + + $teampage_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $teampage_ary[] = array( + 'group_id' => (int) $row['group_id'], + 'teampage_name' => '', + 'teampage_position' => (int) $teampage_groups[$row['group_name']], + 'teampage_parent' => 0, + ); + } + $db->sql_freeresult($result); + + if (sizeof($teampage_ary)) + { + $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_ary); + } +} + /** * Sync post count. We might need to do this in batches. diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 9d59e7a6c9..13d2ed9bd4 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -828,7 +828,10 @@ if (!$get_info) array( 'target' => GROUPS_TABLE, 'autoincrement' => 'group_id', - 'query_first' => array('target', $convert->truncate_statement . GROUPS_TABLE), + 'query_first' => array( + array('target', $convert->truncate_statement . GROUPS_TABLE), + array('target', $convert->truncate_statement . TEAMPAGE_TABLE), + ), array('group_id', 'groups.group_id', ''), array('group_type', 'groups.group_type', 'phpbb_convert_group_type'), @@ -845,6 +848,7 @@ if (!$get_info) 'query_first' => array('target', $convert->truncate_statement . USER_GROUP_TABLE), 'execute_first' => ' add_default_groups(); + add_groups_to_teampage(); ', array('group_id', 'groups.group_id', ''), diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index 4076fe2a78..29e5f7ab09 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1933,3 +1933,43 @@ function phpbb_convert_timezone($timezone) $timezone_migration = new \phpbb\db\migration\data\v310\timezone($config, $db, new \phpbb\db\tools($db), $phpbb_root_path, $phpEx, $table_prefix); return $timezone_migration->convert_phpbb30_timezone($timezone, 0); } + +function phpbb_add_notification_options($user_notify_pm) +{ + global $convert_row, $db; + + $user_id = phpbb_user_id($convert_row['user_id']); + if ($user_id == ANONYMOUS) + { + return; + } + + $rows = array(); + + $rows[] = array( + 'item_type' => 'post', + 'item_id' => 0, + 'user_id' => (int) $user_id, + 'notify' => 1, + 'method' => 'email', + ); + $rows[] = array( + 'item_type' => 'topic', + 'item_id' => 0, + 'user_id' => (int) $user_id, + 'notify' => 1, + 'method' => 'email', + ); + if ($user_notify_pm) + { + $rows[] = array( + 'item_type' => 'pm', + 'item_id' => 0, + 'user_id' => (int) $user_id, + 'notify' => 1, + 'method' => 'email', + ); + } + + $sql = $db->sql_multi_insert(USER_NOTIFICATIONS_TABLE, $rows); +} |