mirror of
https://github.com/friendica/friendica
synced 2025-04-25 20:30:11 +00:00
Issue 11893: Postupdate to fix wrong parents
This commit is contained in:
parent
f0622163b2
commit
ec8377a8c7
2 changed files with 56 additions and 0 deletions
|
@ -701,6 +701,26 @@ class Item
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the uri-id of the parent for the given uri-id
|
||||
*
|
||||
* @param integer $uriid
|
||||
* @return integer
|
||||
*/
|
||||
public static function getParent(int $uriid): int
|
||||
{
|
||||
$thread_parent = Post::selectFirstPost(['thr-parent-id', 'gravity'], ['uri-id' => $uriid]);
|
||||
if (empty($thread_parent)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($thread_parent['gravity'] == GRAVITY_PARENT) {
|
||||
return $uriid;
|
||||
}
|
||||
|
||||
return self::getParent($thread_parent['thr-parent-id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch top-level parent data for the given item array
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue