[XenForo] fix: sort items by date in descending order (#2633)

This commit is contained in:
Dag 2022-04-11 00:42:53 +02:00 committed by GitHub
parent bb81af086f
commit a28481aaa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -149,10 +149,11 @@ class XenForoBridge extends BridgeAbstract {
break; break;
} }
while(count($this->items) > $this->getInput('limit')) { usort($this->items, function($a, $b) {
array_shift($this->items); return $b['timestamp'] <=> $a['timestamp'];
} });
$this->items = array_slice($this->items, 0, $this->getInput('limit'));
} }
/** /**