diff options
author | Mario <mario@mariovavti.com> | 2018-09-28 09:41:21 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-09-28 09:41:21 +0200 |
commit | 9e87219aead74791cdb68d4fa166326a0bd92d78 (patch) | |
tree | 3cec224f7ebca28d3155ff335bf43fc39ea3db39 /include/zot.php | |
parent | 1b7e220de734f30cf22452e36fe6b746676ddf46 (diff) | |
parent | 65785ead697056130d01520a917bfc2626788c0c (diff) | |
download | volse-hubzilla-9e87219aead74791cdb68d4fa166326a0bd92d78.tar.gz volse-hubzilla-9e87219aead74791cdb68d4fa166326a0bd92d78.tar.bz2 volse-hubzilla-9e87219aead74791cdb68d4fa166326a0bd92d78.zip |
Merge branch 'patch-10' into 'dev'
rename groups and group_members tables for MySQL 8 compatibility
See merge request hubzilla/core!1290
Diffstat (limited to 'include/zot.php')
-rw-r--r-- | include/zot.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/include/zot.php b/include/zot.php index e31d650d2..1a632cf87 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3320,13 +3320,13 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) { } if($groups_changed) { - $r = q("select hash as collection, visible, deleted, gname as name from groups where uid = %d", + $r = q("select hash as collection, visible, deleted, gname as name from pgrp where uid = %d", intval($uid) ); if($r) $info['collections'] = $r; - $r = q("select groups.hash as collection, group_member.xchan as member from groups left join group_member on groups.id = group_member.gid where group_member.uid = %d", + $r = q("select pgrp.hash as collection, pgrp_member.xchan as member from pgrp left join pgrp_member on pgrp.id = pgrp_member.gid where pgrp_member.uid = %d", intval($uid) ); if($r) @@ -3734,7 +3734,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { // sync collections (privacy groups) oh joy... if(array_key_exists('collections',$arr) && is_array($arr['collections']) && count($arr['collections'])) { - $x = q("select * from groups where uid = %d", + $x = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); foreach($arr['collections'] as $cl) { @@ -3750,7 +3750,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(($y['gname'] != $cl['name']) || ($y['visible'] != $cl['visible']) || ($y['deleted'] != $cl['deleted'])) { - q("update groups set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", + q("update pgrp set gname = '%s', visible = %d, deleted = %d where hash = '%s' and uid = %d", dbesc($cl['name']), intval($cl['visible']), intval($cl['deleted']), @@ -3759,14 +3759,14 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { ); } if(intval($cl['deleted']) && (! intval($y['deleted']))) { - q("delete from group_member where gid = %d", + q("delete from pgrp_member where gid = %d", intval($y['id']) ); } } } if(! $found) { - $r = q("INSERT INTO groups ( hash, uid, visible, deleted, gname ) + $r = q("INSERT INTO pgrp ( hash, uid, visible, deleted, gname ) VALUES( '%s', %d, %d, %d, '%s' ) ", dbesc($cl['collection']), intval($channel['channel_id']), @@ -3790,10 +3790,10 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } } if(! $found_local) { - q("delete from group_member where gid = %d", + q("delete from pgrp_member where gid = %d", intval($y['id']) ); - q("update groups set deleted = 1 where id = %d and uid = %d", + q("update pgrp set deleted = 1 where id = %d and uid = %d", intval($y['id']), intval($channel['channel_id']) ); @@ -3803,7 +3803,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } // reload the group list with any updates - $x = q("select * from groups where uid = %d", + $x = q("select * from pgrp where uid = %d", intval($channel['channel_id']) ); @@ -3830,7 +3830,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(isset($y['hash']) && isset($members[$y['hash']])) { foreach($members[$y['hash']] as $member) { $found = false; - $z = q("select xchan from group_member where gid = %d and uid = %d and xchan = '%s' limit 1", + $z = q("select xchan from pgrp_member where gid = %d and uid = %d and xchan = '%s' limit 1", intval($y['id']), intval($channel['channel_id']), dbesc($member) @@ -3841,7 +3841,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { // if somebody is in the group that wasn't before - add them if(! $found) { - q("INSERT INTO group_member (uid, gid, xchan) + q("INSERT INTO pgrp_member (uid, gid, xchan) VALUES( %d, %d, '%s' ) ", intval($channel['channel_id']), intval($y['id']), @@ -3852,7 +3852,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } // now retrieve a list of members we have on this site - $m = q("select xchan from group_member where gid = %d and uid = %d", + $m = q("select xchan from pgrp_member where gid = %d and uid = %d", intval($y['id']), intval($channel['channel_id']) ); @@ -3860,7 +3860,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($m as $mm) { // if the local existing member isn't in the list we just received - remove them if(! in_array($mm['xchan'],$members[$y['hash']])) { - q("delete from group_member where xchan = '%s' and gid = %d and uid = %d", + q("delete from pgrp_member where xchan = '%s' and gid = %d and uid = %d", dbesc($mm['xchan']), intval($y['id']), intval($channel['channel_id']) |