Browse Source

fix storing content type

update content db column to longblob
master
Aaron Parecki 7 years ago
parent
commit
13095b601f
No known key found for this signature in database GPG Key ID: 276C2817346D6056
3 changed files with 6 additions and 4 deletions
  1. +4
    -1
      lib/PushTask.php
  2. +2
    -0
      schema/schema.sql
  3. +0
    -3
      scripts/switchboard.php

+ 4
- 1
lib/PushTask.php View File

@ -101,7 +101,10 @@ class PushTask {
$headers = request\parse_headers($response['headers']); $headers = request\parse_headers($response['headers']);
if(array_key_exists('Content-Type', $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->content = $response['body'];
$feed->save(); $feed->save();

+ 2
- 0
schema/schema.sql View File

@ -33,6 +33,8 @@ CREATE TABLE `feeds` (
`feed_type` enum('mf2','atom','rss') DEFAULT NULL, `feed_type` enum('mf2','atom','rss') DEFAULT NULL,
`push_last_ping_received` datetime DEFAULT NULL, `push_last_ping_received` datetime DEFAULT NULL,
`content_hash` varchar(255) DEFAULT NULL, `content_hash` varchar(255) DEFAULT NULL,
`content_type` varchar(255) DEFAULT NULL,
`content` longblob,
`last_retrieved` datetime DEFAULT NULL, `last_retrieved` datetime DEFAULT NULL,
`date_created` datetime DEFAULT NULL, `date_created` datetime DEFAULT NULL,
`date_updated` datetime DEFAULT NULL, `date_updated` datetime DEFAULT NULL,

+ 0
- 3
scripts/switchboard.php View File

@ -19,9 +19,6 @@ $pcntl_continue = TRUE;
define('PDO_SUPPORT_DELAYED', 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'; require 'vendor/autoload.php';
if($mode == 'once') { if($mode == 'once') {

Loading…
Cancel
Save