flux rss v0.5
This commit is contained in:
parent
e678bcf5aa
commit
eb7cbe5ace
@ -124,11 +124,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if already exists
|
||||
$stmt_check = db()->prepare("SELECT id FROM messages WHERE channel_id = ? AND rss_guid = ?");
|
||||
// Check if already exists in processed items (prevents re-posting if deleted by retention policy)
|
||||
$stmt_check = db()->prepare("SELECT id FROM rss_processed_items WHERE channel_id = ? AND rss_guid = ?");
|
||||
$stmt_check->execute([$channel_id, $guid]);
|
||||
if ($stmt_check->fetch()) continue;
|
||||
|
||||
// Insert into processed items first to be safe
|
||||
$stmt_processed = db()->prepare("INSERT IGNORE INTO rss_processed_items (channel_id, rss_guid) VALUES (?, ?)");
|
||||
$stmt_processed->execute([$channel_id, $guid]);
|
||||
|
||||
// Insert as message from a special "RSS Bot" user or system
|
||||
$stmt_bot = db()->prepare("SELECT id FROM users WHERE username = 'RSS Bot' AND is_bot = 1");
|
||||
$stmt_bot->execute();
|
||||
|
||||
9
db/migrations/20260217_rss_processed_items.sql
Normal file
9
db/migrations/20260217_rss_processed_items.sql
Normal file
@ -0,0 +1,9 @@
|
||||
-- Migration: Track processed RSS items to prevent re-posting after they are deleted by retention policy
|
||||
CREATE TABLE IF NOT EXISTS rss_processed_items (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
channel_id INT NOT NULL,
|
||||
rss_guid VARCHAR(255) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY idx_channel_guid (channel_id, rss_guid),
|
||||
FOREIGN KEY (channel_id) REFERENCES channels(id) ON DELETE CASCADE
|
||||
);
|
||||
@ -413,3 +413,7 @@
|
||||
2026-02-16 23:46:41 - GET /index.php?server_id=1&channel_id=12 - POST: []
|
||||
2026-02-16 23:47:02 - GET /index.php?server_id=1&channel_id=12 - POST: []
|
||||
2026-02-16 23:48:40 - GET /index.php?server_id=1&channel_id=12 - POST: []
|
||||
2026-02-17 00:21:52 - GET /?fl_project=38443 - POST: []
|
||||
2026-02-17 00:22:06 - GET /index.php?server_id=1&channel_id=12 - POST: []
|
||||
2026-02-17 00:22:15 - GET /index.php?server_id=1&channel_id=12 - POST: []
|
||||
2026-02-17 00:22:19 - GET /index.php?server_id=1&channel_id=12 - POST: []
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user