diff options
author | Mario <mario@mariovavti.com> | 2022-02-01 10:01:56 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-02-01 10:01:56 +0000 |
commit | eb207898219937435f5735eb96fe32e5b2d489f0 (patch) | |
tree | 002da6491f1ed7f18d1b84a2a8155fd952aa7894 /include/hubloc.php | |
parent | c90862217ef29ee4f3d37d37a8fe6063aa68dbdf (diff) | |
download | volse-hubzilla-eb207898219937435f5735eb96fe32e5b2d489f0.tar.gz volse-hubzilla-eb207898219937435f5735eb96fe32e5b2d489f0.tar.bz2 volse-hubzilla-eb207898219937435f5735eb96fe32e5b2d489f0.zip |
allow zotfinger to recurse through all known hublocs if the one we got does not exist (404) or got removed (410). add functions for updating tables from array and deleting hublocs.
Diffstat (limited to 'include/hubloc.php')
-rw-r--r-- | include/hubloc.php | 11 |
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. |