mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
dirsync update column
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
36
Zotlabs/Update/_1256.php
Normal file
36
Zotlabs/Update/_1256.php
Normal file
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user