Merge pull request #4066 from MrPetovan/bug/4046-remove-group_member-uid
Remove group_member.uid
This commit is contained in:
commit
39dcec66d8
8 changed files with 11 additions and 14 deletions
2
boot.php
2
boot.php
|
@ -43,7 +43,7 @@ define('FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define('FRIENDICA_CODENAME', 'Asparagus');
|
define('FRIENDICA_CODENAME', 'Asparagus');
|
||||||
define('FRIENDICA_VERSION', '3.6-dev');
|
define('FRIENDICA_VERSION', '3.6-dev');
|
||||||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||||
define('DB_UPDATE_VERSION', 1236);
|
define('DB_UPDATE_VERSION', 1237);
|
||||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -529,7 +529,7 @@ function acl_lookup(App $a, $out_type = 'json') {
|
||||||
// This can be done when we can delete cache entries via wildcard
|
// This can be done when we can delete cache entries via wildcard
|
||||||
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
|
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
|
||||||
FROM `group`
|
FROM `group`
|
||||||
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`
|
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id`
|
||||||
WHERE NOT `group`.`deleted` AND `group`.`uid` = %d
|
WHERE NOT `group`.`deleted` AND `group`.`uid` = %d
|
||||||
$sql_extra
|
$sql_extra
|
||||||
GROUP BY `group`.`name`, `group`.`id`
|
GROUP BY `group`.`name`, `group`.`id`
|
||||||
|
|
|
@ -232,8 +232,6 @@ function import_account(App $a, $file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($account['group_member'] as &$group_member) {
|
foreach ($account['group_member'] as &$group_member) {
|
||||||
$group_member['uid'] = $newuid;
|
|
||||||
|
|
||||||
$import = 0;
|
$import = 0;
|
||||||
foreach ($account['group'] as $group) {
|
foreach ($account['group'] as $group) {
|
||||||
if ($group['id'] == $group_member['gid'] && isset($group['newid'])) {
|
if ($group['id'] == $group_member['gid'] && isset($group['newid'])) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ function uexport_account($a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
$group_member = _uexport_multirow(
|
$group_member = _uexport_multirow(
|
||||||
sprintf("SELECT * FROM `group_member` WHERE uid = %d", intval(local_user()))
|
sprintf("SELECT `group_member`.`gid`, `group_member`.`contact-id` FROM `group_member` INNER JOIN `group` ON `group`.`id` = `group_member`.`gid` WHERE `group`.`uid` = %d", intval(local_user()))
|
||||||
);
|
);
|
||||||
|
|
||||||
$output = array(
|
$output = array(
|
||||||
|
|
|
@ -990,15 +990,13 @@ class DBStructure {
|
||||||
$database["group_member"] = array(
|
$database["group_member"] = array(
|
||||||
"fields" => array(
|
"fields" => array(
|
||||||
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||||
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
|
|
||||||
"gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
|
"gid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("group" => "id")),
|
||||||
"contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
|
"contact-id" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("contact" => "id")),
|
||||||
),
|
),
|
||||||
"indexes" => array(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"PRIMARY" => array("id"),
|
||||||
"contactid" => array("contact-id"),
|
"contactid" => array("contact-id"),
|
||||||
"gid_contactid" => array("gid", "contact-id"),
|
"gid_contactid" => array("UNIQUE", "gid", "contact-id"),
|
||||||
"uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$database["gserver"] = array(
|
$database["gserver"] = array(
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Contact extends BaseObject
|
||||||
INNER JOIN `group_member`
|
INNER JOIN `group_member`
|
||||||
ON `contact`.`id` = `group_member`.`contact-id`
|
ON `contact`.`id` = `group_member`.`contact-id`
|
||||||
WHERE `gid` = ?
|
WHERE `gid` = ?
|
||||||
AND `group_member`.`uid` = ?
|
AND `contact`.`uid` = ?
|
||||||
AND NOT `contact`.`self`
|
AND NOT `contact`.`self`
|
||||||
AND NOT `contact`.`blocked`
|
AND NOT `contact`.`blocked`
|
||||||
AND NOT `contact`.`pending`
|
AND NOT `contact`.`pending`
|
||||||
|
@ -73,7 +73,7 @@ class Contact extends BaseObject
|
||||||
INNER JOIN `group_member`
|
INNER JOIN `group_member`
|
||||||
ON `contact`.`id` = `group_member`.`contact-id`
|
ON `contact`.`id` = `group_member`.`contact-id`
|
||||||
WHERE `gid` = ?
|
WHERE `gid` = ?
|
||||||
AND `group_member`.`uid` = ?
|
AND `contact`.`uid` = ?
|
||||||
AND `contact`.`network` = ?
|
AND `contact`.`network` = ?
|
||||||
AND `contact`.`notify` != ""',
|
AND `contact`.`notify` != ""',
|
||||||
$gid,
|
$gid,
|
||||||
|
@ -605,7 +605,9 @@ class Contact extends BaseObject
|
||||||
AND NOT `pending`
|
AND NOT `pending`
|
||||||
AND `id` NOT IN (
|
AND `id` NOT IN (
|
||||||
SELECT DISTINCT(`contact-id`)
|
SELECT DISTINCT(`contact-id`)
|
||||||
FROM `group_member` WHERE `uid` = %d
|
FROM `group_member`
|
||||||
|
INNER JOIN `group` ON `group`.`id` = `group_member`.`gid`
|
||||||
|
WHERE `group`.`uid` = %d
|
||||||
)
|
)
|
||||||
LIMIT %d, %d", intval($uid), intval($uid), intval($start), intval($count)
|
LIMIT %d, %d", intval($uid), intval($uid), intval($start), intval($count)
|
||||||
);
|
);
|
||||||
|
|
|
@ -96,8 +96,7 @@ class Group extends BaseObject
|
||||||
AND `contact-id` IN
|
AND `contact-id` IN
|
||||||
(SELECT `contact-id`
|
(SELECT `contact-id`
|
||||||
FROM `group_member`
|
FROM `group_member`
|
||||||
WHERE `group_member`.`gid` = `group`.`id`
|
WHERE `group_member`.`gid` = `group`.`id`)
|
||||||
AND `group_member`.`uid` = ?)
|
|
||||||
) AS `count`
|
) AS `count`
|
||||||
FROM `group`
|
FROM `group`
|
||||||
WHERE `group`.`uid` = ?;",
|
WHERE `group`.`uid` = ?;",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('UPDATE_VERSION' , 1236);
|
define('UPDATE_VERSION' , 1237);
|
||||||
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
|
|
Loading…
Reference in a new issue