aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2023-04-26 17:58:35 +0200
committerMario Vavti <mario@mariovavti.com>2023-04-26 17:58:35 +0200
commitd79290df75b214f50f0d9ec586a7b855e3a86106 (patch)
treec104db7bfdf8559dbda48ddc3f0b0b291735a662 /Zotlabs
parent0bf65bcad5f11be5b8d8e3280fc2f96f150a8830 (diff)
downloadvolse-hubzilla-d79290df75b214f50f0d9ec586a7b855e3a86106.tar.gz
volse-hubzilla-d79290df75b214f50f0d9ec586a7b855e3a86106.tar.bz2
volse-hubzilla-d79290df75b214f50f0d9ec586a7b855e3a86106.zip
dirsync update column
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Poller.php2
-rw-r--r--Zotlabs/Lib/Libzotdir.php4
-rw-r--r--Zotlabs/Module/Dirsearch.php5
-rw-r--r--Zotlabs/Update/_1256.php36
4 files changed, 42 insertions, 5 deletions
diff --git a/Zotlabs/Daemon/Poller.php b/Zotlabs/Daemon/Poller.php
index b6b52af81..77a428ec3 100644
--- a/Zotlabs/Daemon/Poller.php
+++ b/Zotlabs/Daemon/Poller.php
@@ -170,7 +170,7 @@ class Poller {
$dirmode = intval(get_config('system', 'directory_mode'));
if ($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
- $r = q("SELECT * FROM updates WHERE ud_flags = 1 AND (ud_last = '%s' OR ud_last > %s - INTERVAL %s)",
+ $r = q("SELECT * FROM updates WHERE ud_update = 1 AND (ud_last = '%s' OR ud_last > %s - INTERVAL %s)",
dbesc(NULL_DATE),
db_utcnow(),
db_quoteinterval('7 DAY')
diff --git a/Zotlabs/Lib/Libzotdir.php b/Zotlabs/Lib/Libzotdir.php
index bd5078f9e..548164baa 100644
--- a/Zotlabs/Lib/Libzotdir.php
+++ b/Zotlabs/Lib/Libzotdir.php
@@ -279,13 +279,13 @@ class Libzotdir {
continue;
}
- q("UPDATE updates SET ud_flags = 1 WHERE ud_id = %d",
+ q("UPDATE updates SET ud_update = 1 WHERE ud_id = %d",
dbesc($r[0]['ud_id'])
);
}
else {
$t['transaction_id'] = strpos($t['transaction_id'], '@') === false ? $t['transaction_id'] : substr($t['transaction_id'], strpos($t['transaction_id'], '@') + 1);
- q("insert into updates ( ud_hash, ud_guid, ud_date, ud_addr, ud_flags )
+ q("insert into updates ( ud_hash, ud_guid, ud_date, ud_addr, ud_update )
values ( '%s', '%s', '%s', '%s', 1 ) ",
dbesc($t['hash']),
dbesc($t['host'] ?? $t['transaction_id']), // 2023-04-12 transaction_id is deprecated
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index 62bf99b67..22b030edf 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -218,7 +218,7 @@ class Dirsearch extends Controller {
if($sync) {
$spkt = array('transactions' => array());
- $r = q("SELECT * FROM updates WHERE ud_flags = 0 AND ud_last = '%s' AND ud_date >= '%s' ORDER BY ud_date DESC",
+ $r = q("SELECT * FROM updates WHERE ud_update = 0 AND ud_last = '%s' AND ud_date >= '%s' ORDER BY ud_date DESC",
dbesc(NULL_DATE),
dbesc($sync)
);
@@ -230,7 +230,8 @@ class Dirsearch extends Controller {
'address' => $rr['ud_addr'],
'host' => $rr['ud_guid'],
'transaction_id' => $rr['ud_guid'], // deprecated 2023-04-12
- 'timestamp' => $rr['ud_date']
+ 'timestamp' => $rr['ud_date'],
+ 'flags' => $rr['ud_flags']
];
}
}
diff --git a/Zotlabs/Update/_1256.php b/Zotlabs/Update/_1256.php
new file mode 100644
index 000000000..db9537117
--- /dev/null
+++ b/Zotlabs/Update/_1256.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Zotlabs\Update;
+
+class _1256 {
+
+ function run() {
+
+ dbq("START TRANSACTION");
+
+ $r1 = dbq("TRUNCATE TABLE updates");
+
+ if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
+ $r2a = dbq("ALTER TABLE updates add ud_update numeric(1) NOT NULL DEFAULT '0'");
+ $r2b = dbq("CREATE INDEX ud_update ON updates (ud_update)");
+
+ $r2 = ($r2a && $r2b);
+ }
+
+ if(ACTIVE_DBTYPE == DBTYPE_MYSQL) {
+ $r2 = dbq("ALTER TABLE updates add ud_update tinyint(1) NOT NULL DEFAULT '',
+ KEY ud_update (ud_update)"
+ );
+ }
+
+ if($r1 && $r2) {
+ dbq("COMMIT");
+ return UPDATE_SUCCESS;
+ }
+
+ q("ROLLBACK");
+ return UPDATE_FAILED;
+
+ }
+
+}