mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-20 16:50:41 -04:00
remove updates entry if a xchan_hash mismatch is encountered
This commit is contained in:
@@ -357,6 +357,11 @@ class Libzotdir {
|
|||||||
if($zf && array_path_exists('signature/signer',$zf) && $zf['signature']['signer'] === $href && intval($zf['signature']['header_valid'])) {
|
if($zf && array_path_exists('signature/signer',$zf) && $zf['signature']['signer'] === $href && intval($zf['signature']['header_valid'])) {
|
||||||
$xc = Libzot::import_xchan($zf['data']);
|
$xc = Libzot::import_xchan($zf['data']);
|
||||||
|
|
||||||
|
// xchan_hash mismatch - this can happen after a site re-install at the same url
|
||||||
|
if ($xc['success'] && $xc['hash'] !== $ud['ud_hash']) {
|
||||||
|
self::delete_by_hash($ud['ud_hash']);
|
||||||
|
}
|
||||||
|
|
||||||
// This is a workaround for a missing xchan_updated column
|
// This is a workaround for a missing xchan_updated column
|
||||||
// TODO: implement xchan_updated in the xchan table and update this column instead
|
// TODO: implement xchan_updated in the xchan table and update this column instead
|
||||||
if($zf['data']['primary_location']['address'] && $zf['data']['primary_location']['url']) {
|
if($zf['data']['primary_location']['address'] && $zf['data']['primary_location']['url']) {
|
||||||
@@ -365,6 +370,7 @@ class Libzotdir {
|
|||||||
dbesc($zf['data']['primary_location']['url'])
|
dbesc($zf['data']['primary_location']['url'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -714,4 +720,28 @@ class Libzotdir {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief deletes a entry in updates by hash
|
||||||
|
*
|
||||||
|
* @param string $hash the channel hash
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
|
||||||
|
static function delete_by_hash($hash) {
|
||||||
|
if (!$hash) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$x = q("DELETE FROM updates WHERE ud_hash = '%s'",
|
||||||
|
dbesc($hash)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($x) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user