aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Timeline/GlobalTimeline.php
blob: b49517440df9a5e7f03712417c4c138ee9ab582f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
namespace Digitigrade\Timeline;

use Digitigrade\Db;
use Digitigrade\Timeline;

class GlobalTimeline extends Timeline {
    protected function getNoteIds(int $limit, int $offset): array {
        $db = Db::getInstance()->getPdo();
        $stmt = $db->prepare(<<<END
        SELECT note.id FROM note LEFT JOIN note_privacy ON note_privacy.note_id = note.id
        WHERE note_privacy.scope = 'public' AND note_privacy.indexable = true
        ORDER BY note.created DESC LIMIT ? OFFSET ?
        END);
        $stmt->execute([$limit, $offset]);
        return $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
    }
}