mirror of
https://github.com/friendica/friendica
synced 2024-12-22 19:20:17 +00:00
Post update added
This commit is contained in:
parent
b50f91b3e1
commit
59bebe7bcf
3 changed files with 45 additions and 5 deletions
|
@ -2391,7 +2391,7 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo On private posts we could obfuscate the date
|
/// @todo On private posts we could obfuscate the date
|
||||||
$update = ($arr['private'] != self::PRIVATE);
|
$update = ($arr['private'] != self::PRIVATE) || in_array($arr['network'], Protocol::FEDERATED);
|
||||||
|
|
||||||
// Is it a forum? Then we don't care about the rules from above
|
// Is it a forum? Then we don't care about the rules from above
|
||||||
if (!$update && in_array($arr["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN]) && ($arr["parent-uri"] === $arr["uri"])) {
|
if (!$update && in_array($arr["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN]) && ($arr["parent-uri"] === $arr["uri"])) {
|
||||||
|
@ -2409,15 +2409,15 @@ class Item
|
||||||
} else {
|
} else {
|
||||||
$condition = ['id' => $arr['contact-id'], 'self' => false];
|
$condition = ['id' => $arr['contact-id'], 'self' => false];
|
||||||
}
|
}
|
||||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']], $condition);
|
DBA::update('contact', ['failed' => false, 'success_update' => $arr['received'], 'last-item' => $arr['received']], $condition);
|
||||||
}
|
}
|
||||||
// Now do the same for the system wide contacts with uid=0
|
// Now do the same for the system wide contacts with uid=0
|
||||||
if ($arr['private'] != self::PRIVATE) {
|
if ($arr['private'] != self::PRIVATE) {
|
||||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
DBA::update('contact', ['failed' => false, 'success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||||
['id' => $arr['owner-id']]);
|
['id' => $arr['owner-id']]);
|
||||||
|
|
||||||
if ($arr['owner-id'] != $arr['author-id']) {
|
if ($arr['owner-id'] != $arr['author-id']) {
|
||||||
DBA::update('contact', ['success_update' => $arr['received'], 'last-item' => $arr['received']],
|
DBA::update('contact', ['failed' => false, 'success_update' => $arr['received'], 'last-item' => $arr['received']],
|
||||||
['id' => $arr['author-id']]);
|
['id' => $arr['author-id']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1356);
|
define('DB_UPDATE_VERSION', 1357);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
40
update.php
40
update.php
|
@ -535,3 +535,43 @@ function update_1354()
|
||||||
}
|
}
|
||||||
return Update::SUCCESS;
|
return Update::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1357()
|
||||||
|
{
|
||||||
|
if (!DBA::e("UPDATE `contact` SET `failed` = true WHERE `success_update` < `failure_update` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `contact` SET `failed` = false WHERE `success_update` > `failure_update` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `contact` SET `failed` = false WHERE `updated` > `failure_update` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `contact` SET `failed` = false WHERE `last-item` > `failure_update` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `gserver` SET `failed` = true WHERE `last_contact` < `last_failure` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `gserver` SET `failed` = false WHERE `last_contact` > `last_failure` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `gcontact` SET `failed` = true WHERE `last_contact` < `last_failure` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `gcontact` SET `failed` = false WHERE `last_contact` > `last_failure` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DBA::e("UPDATE `gcontact` SET `failed` = false WHERE `updated` > `last_failure` AND `failed` IS NULL")) {
|
||||||
|
return Update::FAILED;
|
||||||
|
}
|
||||||
|
return Update::SUCCESS;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue