9 public function __construct(Dependencies $deps)
12 $this->db = $deps->db;
13 $this->log = $deps->log;
16 public function listAll()
18 $this->log->info('Listing all feeds..');
19 $res = $this->db->query('SELECT * FROM feeds ORDER BY f_id');
21 while ($feedRow = $res->fetch(\PDO::FETCH_OBJ)) {
22 echo '#' . $feedRow->f_id . ' ' . $feedRow->f_url . "\n";
25 $this->log->info('Finished listing %d URLs.', $items);
28 public function addFeed($url)
36 'INSERT INTO feeds SET'
37 . ' f_url = ' . $this->db->quote($url)
38 . ', f_needs_update = 1'
40 echo "Feed has been added\n";
43 public function removeFeed($urlOrId)
46 echo "URL/ID empty\n";
50 if (is_numeric($urlOrId)) {
51 $sqlWhere = ' f_id = ' . $this->db->quote($urlOrId);
53 $sqlWhere = ' f_url = ' . $this->db->quote($urlOrId);
56 $nRows = $this->db->exec(
57 'DELETE FROM feeds WHERE' . $sqlWhere
59 echo sprintf("%d feed has been removed\n", $nRows);;