*/
public static function calculateInteractionScore(int $uid)
{
- $days = DI::config()->get('system', 'interaction_score_days');
+ $days = DI::config()->get('channel', 'interaction_score_days');
$contact_id = Contact::getPublicIdByUserId($uid);
Logger::debug('Calculation - start', ['uid' => $uid, 'cid' => $contact_id, 'days' => $days]);
use Friendica\Core\Protocol;
use Friendica\Database\Database;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Post;
return;
}
- if ($parent['created'] < DateTimeFormat::utc('now - 1 day')) {
+ if ($parent['created'] < DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' 24 hour')) {
Logger::debug('Post is too old', ['uri-id' => $item['uri-id'], 'parent-uri-id' => $item['parent-uri-id'], 'created' => $parent['created']]);
return;
}
public static function expire()
{
- DBA::delete('post-engagement', ["`created` < ?", DateTimeFormat::utc('now - 1 day')]);
+ DBA::delete('post-engagement', ["`created` < ?", DateTimeFormat::utc('now - ' . DI::config()->get('channel', 'engagement_hours') . ' 24 hour')]);
Logger::notice('Cleared expired engagements', ['rows' => DBA::affectedRows()]);
}
}
*/
protected static function getItems()
{
- $post = DBA::selectToArray('post-engagement', ['comments'], [], ['order' => ['comments' => true], 'limit' => [100, 1]]);
-
if (self::$content == self::WHATSHOT) {
+ $post = DBA::selectToArray('post-engagement', ['comments'], [], ['order' => ['comments' => true], 'limit' => [DI::config()->get('channel', 'hot_posts_item_limit'), 1]]);
$comments = $post[0]['comments'] ?? 0;
if (!is_null(self::$accountType)) {
$condition = ["`comments` >= ? AND `contact-type` = ?", $comments, self::$accountType];