aboutsummaryrefslogtreecommitdiffstats
path: root/include/Contact.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-20 15:35:42 -0800
committerfriendica <info@friendica.com>2015-01-20 15:35:42 -0800
commit6f11f20992c88ff48a55929e94d9003fcc437062 (patch)
tree8eecb1327151a63ac6cd0421c56e56bb18009164 /include/Contact.php
parent70fb47248b6579beabc81287750bc18aab2a7ddd (diff)
downloadvolse-hubzilla-6f11f20992c88ff48a55929e94d9003fcc437062.tar.gz
volse-hubzilla-6f11f20992c88ff48a55929e94d9003fcc437062.tar.bz2
volse-hubzilla-6f11f20992c88ff48a55929e94d9003fcc437062.zip
first cut at unpacking bitfields in hubloc, fixed hubloc_error and hubloc_deleted
Diffstat (limited to 'include/Contact.php')
-rw-r--r--include/Contact.php28
1 files changed, 9 insertions, 19 deletions
diff --git a/include/Contact.php b/include/Contact.php
index 4c80f5d6a..4a016e32f 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -272,8 +272,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
);
- $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s'",
- intval(HUBLOC_FLAGS_DELETED),
+ $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s'",
dbesc($channel['channel_hash'])
);
@@ -312,8 +311,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
intval($channel_id)
);
- $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s' and hubloc_url = '%s' ",
- intval(HUBLOC_FLAGS_DELETED),
+ $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s' and hubloc_url = '%s' ",
dbesc($channel['channel_hash']),
dbesc(z_root())
);
@@ -322,9 +320,8 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
$hublocs = 0;
- $r = q("select hubloc_id from hubloc where hubloc_hash = '%s' and not (hubloc_flags & %d)>0",
- dbesc($channel['channel_hash']),
- intval(HUBLOC_FLAGS_DELETED)
+ $r = q("select hubloc_id from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0",
+ dbesc($channel['channel_hash'])
);
if($r)
$hublocs = count($r);
@@ -374,10 +371,8 @@ function mark_orphan_hubsxchans() {
if($dirmode == DIRECTORY_MODE_NORMAL)
return;
- $r = q("update hubloc set hubloc_status = (hubloc_status | %d) where not (hubloc_status & %d)>0
+ $r = q("update hubloc set hubloc_error = 1 where hubloc_error = 0
and hubloc_network = 'zot' and hubloc_connected < %s - interval %s",
- intval(HUBLOC_OFFLINE),
- intval(HUBLOC_OFFLINE),
db_utcnow(), db_quoteinterval('36 day')
);
@@ -394,9 +389,7 @@ function mark_orphan_hubsxchans() {
// }
- $r = q("select hubloc_id, hubloc_hash from hubloc where (hubloc_status & %d)>0 and not (hubloc_flags & %d)>0",
- intval(HUBLOC_OFFLINE),
- intval(HUBLOC_FLAGS_ORPHANCHECK)
+ $r = q("select hubloc_id, hubloc_hash from hubloc where hubloc_error = 0 and hubloc_orphancheck = 0",
);
if($r) {
@@ -404,9 +397,8 @@ function mark_orphan_hubsxchans() {
// see if any other hublocs are still alive for this channel
- $x = q("select * from hubloc where hubloc_hash = '%s' and not (hubloc_status & %d)>0",
+ $x = q("select * from hubloc where hubloc_hash = '%s' and hubloc_error = 0",
dbesc($rr['hubloc_hash']),
- intval(HUBLOC_OFFLINE)
);
if($x) {
@@ -431,8 +423,7 @@ function mark_orphan_hubsxchans() {
// mark that we've checked this entry so we don't need to do it again
- $y = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d",
- intval(HUBLOC_FLAGS_ORPHANCHECK),
+ $y = q("update hubloc set hubloc_orphancheck = 1 where hubloc_id = %d",
dbesc($rr['hubloc_id'])
);
}
@@ -501,8 +492,7 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
// directory servers need to keep the record around for sync purposes - mark it deleted
- $r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s'",
- intval(HUBLOC_FLAGS_DELETED),
+ $r = q("update hubloc set hubloc_deleted = 1 where hubloc_hash = '%s'",
dbesc($xchan)
);