From 13095b601f2ac478ebc92c6c392659f1a3dfa249 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Thu, 30 Nov 2017 11:36:56 -0800 Subject: [PATCH] fix storing content type update content db column to longblob --- lib/PushTask.php | 5 ++++- schema/schema.sql | 2 ++ scripts/switchboard.php | 3 --- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/PushTask.php b/lib/PushTask.php index f61c7ee..ccb9d60 100644 --- a/lib/PushTask.php +++ b/lib/PushTask.php @@ -101,7 +101,10 @@ class PushTask { $headers = request\parse_headers($response['headers']); if(array_key_exists('Content-Type', $headers)) { - $feed->content_type = $headers['Content-Type']; + if(is_array($headers['Content-Type'])) + $feed->content_type = $headers['Content-Type'][0]; + else + $feed->content_type = $headers['Content-Type']; } $feed->content = $response['body']; $feed->save(); diff --git a/schema/schema.sql b/schema/schema.sql index f2ba438..8b1de50 100644 --- a/schema/schema.sql +++ b/schema/schema.sql @@ -33,6 +33,8 @@ CREATE TABLE `feeds` ( `feed_type` enum('mf2','atom','rss') DEFAULT NULL, `push_last_ping_received` datetime DEFAULT NULL, `content_hash` varchar(255) DEFAULT NULL, + `content_type` varchar(255) DEFAULT NULL, + `content` longblob, `last_retrieved` datetime DEFAULT NULL, `date_created` datetime DEFAULT NULL, `date_updated` datetime DEFAULT NULL, diff --git a/scripts/switchboard.php b/scripts/switchboard.php index 4a92a0c..6d5527c 100644 --- a/scripts/switchboard.php +++ b/scripts/switchboard.php @@ -19,9 +19,6 @@ $pcntl_continue = TRUE; define('PDO_SUPPORT_DELAYED', TRUE); -// TODO: add support for forking and running many workers in parallel -// e.g. `php run.php 10` - require 'vendor/autoload.php'; if($mode == 'once') {