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

use Digitigrade\Db;
use Digitigrade\Timeline;

class LocalTimeline 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
        LEFT JOIN actor ON note.author = actor.id
        WHERE note_privacy.scope = 'public' AND note_privacy.indexable = true AND actor.is_local = true AND note.deleted = false
        ORDER BY note.created DESC LIMIT ? OFFSET ?
        END);
        $stmt->execute([$limit, $offset]);
        return $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
    }
}