aboutsummaryrefslogtreecommitdiffstats
path: root/include/hubloc.php
diff options
context:
space:
mode:
authormjfriaza <mjfriaza@disroot.org>2022-05-17 13:44:06 +0200
committermjfriaza <mjfriaza@disroot.org>2022-05-17 13:44:06 +0200
commita75c61d71efebf43713026200aa0f513bd7eef09 (patch)
tree909048adeaa329813e2530d43626ed3bd711bc25 /include/hubloc.php
parent481ecee9e87342ca7a1217395085e95d1a3b61ea (diff)
parent0d0f73fb67bbfcc53058cefded85ac36f951c7a7 (diff)
downloadvolse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.tar.gz
volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.tar.bz2
volse-hubzilla-a75c61d71efebf43713026200aa0f513bd7eef09.zip
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'include/hubloc.php')
-rw-r--r--include/hubloc.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/hubloc.php b/include/hubloc.php
index 2cce7a725..6401d1f0d 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -16,6 +16,8 @@ use Zotlabs\Daemon\Master;
*/
function hubloc_store_lowlevel($arr) {
+ $update = ((array_key_exists('hubloc_id',$arr) && $arr['hubloc_id']) ? 'hubloc_id = ' . intval($arr['hubloc_id']) : false);
+
$store = [
'hubloc_guid' => ((array_key_exists('hubloc_guid',$arr)) ? $arr['hubloc_guid'] : ''),
'hubloc_guid_sig' => ((array_key_exists('hubloc_guid_sig',$arr)) ? $arr['hubloc_guid_sig'] : ''),
@@ -40,7 +42,7 @@ function hubloc_store_lowlevel($arr) {
'hubloc_deleted' => ((array_key_exists('hubloc_deleted',$arr)) ? $arr['hubloc_deleted'] : 0)
];
- return create_table_from_array('hubloc', $store);
+ return (($update) ? update_table_from_array('hubloc', $store, $update) : create_table_from_array('hubloc', $store));
}
function site_store_lowlevel($arr) {
@@ -283,6 +285,13 @@ function hubloc_change_primary($hubloc) {
return true;
}
+function hubloc_delete($hubloc) {
+ if (is_array($hubloc) && array_key_exists('hubloc_id', $hubloc)) {
+ q("UPDATE hubloc SET hubloc_deleted = 1 WHERE hubloc_id = %d",
+ intval($hubloc['hubloc_id'])
+ );
+ }
+}
/**
* @brief Mark a hubloc as down.