aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2023-04-12 23:07:19 +0200
committerMario Vavti <mario@mariovavti.com>2023-04-12 23:07:19 +0200
commit64f30831ac1176baedba9952ff56c51e000ae5f2 (patch)
treef8f172c12ab458a85a7177e56a5aa7e744edcd4e
parentbf5722cd25d2b837253ce2c63ec9decb61124040 (diff)
downloadvolse-hubzilla-64f30831ac1176baedba9952ff56c51e000ae5f2.tar.gz
volse-hubzilla-64f30831ac1176baedba9952ff56c51e000ae5f2.tar.bz2
volse-hubzilla-64f30831ac1176baedba9952ff56c51e000ae5f2.zip
rename update_modtime() to update() and only bump ud_date if something actually changed
-rw-r--r--Zotlabs/Lib/Libzot.php6
-rw-r--r--Zotlabs/Lib/Libzotdir.php54
2 files changed, 16 insertions, 44 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 743100506..bf6d02a72 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -968,8 +968,10 @@ class Libzot {
}
}
- // update updates if anything changed
- Libzotdir::update_modtime($xchan_hash, $address);
+
+ // update updates if anything changed bump the ud_date
+ Libzotdir::update($xchan_hash, $address, $changed);
+
if (empty($ret['message'])) {
$ret['success'] = true;
diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php
index 025326d51..48f966404 100644
--- a/Zotlabs/Lib/Libzotdir.php
+++ b/Zotlabs/Lib/Libzotdir.php
@@ -293,23 +293,6 @@ class Libzotdir {
dbesc($t['address'])
);
}
-
-/*
- $ud_flags = 0;
- if (is_array($t['flags']) && in_array('deleted',$t['flags']))
- $ud_flags |= UPDATE_FLAGS_DELETED;
- if (is_array($t['flags']) && in_array('forced',$t['flags']))
- $ud_flags |= UPDATE_FLAGS_FORCED;
-
- $z = q("insert into updates ( ud_hash, ud_guid, ud_date, ud_flags, ud_addr )
- values ( '%s', '%s', '%s', %d, '%s' ) ",
- dbesc($t['hash']),
- dbesc($t['transaction_id']),
- dbesc($t['timestamp']),
- intval($ud_flags),
- dbesc($t['address'])
- );
-*/
}
}
}
@@ -450,7 +433,7 @@ class Libzotdir {
);
}
- self::update_modtime($hash, $p[0]['xchan_url']);
+ self::update($hash, $p[0]['xchan_url']);
}
@@ -653,12 +636,12 @@ class Libzotdir {
/**
* @brief
*
- * @param string $hash
- * @param string $addr
- * @param int $flags (optional) default 0
+ * @param string $hash the channel hash
+ * @param string $addr the channel url
+ * @param bool $bump_date (optional) default true
*/
- static function update_modtime($hash, $addr, $flags = 0) {
+ static function update($hash, $addr, $bump_date = true) {
$dirmode = intval(get_config('system', 'directory_mode'));
@@ -674,9 +657,13 @@ class Libzotdir {
dbesc($hash)
);
+ $date_sql = '';
+ if ($bump_date) {
+ $date_sql = "ud_date = '" . dbesc(datetime_convert()) . "'";
+ }
+
if ($u) {
- $x = q("UPDATE updates SET ud_date = '%s', ud_last = '%s', ud_guid = '%s', ud_addr = '%s', ud_flags = 0 WHERE ud_id = %d",
- dbesc(datetime_convert()),
+ $x = q("UPDATE updates SET $date_sql, ud_last = '%s', ud_guid = '%s', ud_addr = '%s', ud_flags = 0 WHERE ud_id = %d",
dbesc(NULL_DATE),
dbesc(\App::get_hostname()),
dbesc($addr),
@@ -694,24 +681,7 @@ class Libzotdir {
);
return;
-/*
- if($flags) {
- q("insert into updates (ud_hash, ud_guid, ud_date, ud_flags, ud_addr ) values ( '%s', '%s', '%s', %d, '%s' )",
- dbesc($hash),
- dbesc($guid),
- dbesc(datetime_convert()),
- intval($flags),
- dbesc($addr)
- );
- }
- else {
- q("update updates set ud_flags = ( ud_flags | %d ) where ud_addr = '%s' and not (ud_flags & %d)>0 ",
- intval(UPDATE_FLAGS_UPDATED),
- dbesc($addr),
- intval(UPDATE_FLAGS_UPDATED)
- );
- }
-*/
+
}
}